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

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:

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

Copyright © 1997–2017 Art. Lebedev Studio | Last updated: 20.04.2017