Next | Pseudohashes | 6 |
This idea was developed over the next few years
Big problem: This cannot be translated at compile time
$self->{$key}
Solution: $self will be an arrayref that pretends to be a hashref
A “pseudo-hash”
It will carry around a hash that maps keys to values:
[ { NAME => 1, TYPE => 2, size => 3, ... }, "Fenchurch", "Octopus", "Small", 3, undef, ... ]
You are now allowed to use an arrayref as if it were a hashref
This was formerly an error:
$array_ref->{$key}
Now it is an abbreviation for this:
$array_ref->[$array_ref->[0]->{$key}]
continued...
Next | 6 |