Nathan Torkington wrote:
> # making this part up
> struct Person => [ qw(Name Age Height Weight) ];
> # but once you have a named structure, you can say ...
> my Person %nat;
> with (%nat) {
> $Name = "Nathan"; # rewritten to $nat{Name} at compile-time
> ...
> }
>
> It's kinda like fields.pm only for real hashes not pseudohashes.
>
> Nat
okay but we still have the hiding issue, in case we want it to
work with arbitrary hashes as well as defined structures: a neat
trick if we can do it, and we can. In that case, the hiding properties
are not just one more thing to keep track of but become a
security issue analougous to having . early in yout $PATH variable.
Therefore a way to indicate "this is near the end of a record name"
is required. Dot already means too much (although is it defined
between barewords? It might work, it works elsewhere) so I used \
in the way of the directory indicator from DOS, and in an allusion
to unary \ as the reference-of operator.
And you dont have to make sure the $s on the left of the names match
the {}s on the right, just use one $ and string the names together with
backslashes. This is not easier?
$one{two} is $one\two
$$one{two}{three} is $one\two\three
$$$one{two}{three}{four} is $one\two\three\four
If we have _that_ already,
with %one\two {
push @\three\four, 5,6;
}
is clear and invulnerable.
--
David Nicol 816.235.1187 [EMAIL PROTECTED]
Laziness with responsibility http://www.tipjar.com/kcpm