Fields

Fields of hash are the keys, the value of which we get by referring to it:
$hash.key

Such a construction will return value associated with the key. If non-existing key is referred to, the value of key
_default will be returned, if specified.

Prior to version 3.4.4 this syntax can be also used to get hash methods.Since 3.4.4 hash methods can only be accessed by calling them,
^my_hash.method[], moreover methods take precedence before fields.
Since version 3.4.5,
_default is treated as the default key only if it is written in the parser code.

Assigning something to hash key actually adds or updates a pair key/value in the hash:
$my_hash.key[value]

For better interchangeability of hashes and tables, field
fields contains reference to hash itself, see "Using hash instead of table".


Copyright © 1997–2021 Art. Lebedev Studio | http://www.artlebedev.com Last updated: 20.04.2017