> Why can't we just apply the same warnings on hashes as we do on
> variables in Perl? Maybe a new lexical pragma:
>
> no autoviv; # any autovivification carps (not just
> # hashes)
>
> no autoviv 'HASH'; # no new keys may spring into existence on
> # any hash from this point forward
I don't appose these, but I don't think they solve the problem.
For a start they're compile-time, not run-time.
> no autoviv '%hash'; # same but for a specific hash
> no autoviv '@array'; # same but for a specific array
These won't work, since most of the hashes were interested in
controlling autovivification on are anonymous (blessed) ones.
> Regardless, I feel that "no autovivification" and "private-ization"
> are orthogonal and should be treated as such in the languge.
>
> private @person{'fname','lname'}; # make these private
> freeze %person; # no new keys
>
> But that's two keywords rather than one (and the second keyword isn't
> that great for those people who already use FreezeThaw ;-)
I think that would prove annoying. Though I certainly don't oppose some
separate method to shut off autovivification (which C<private> would
then be considered to call automatically).
> P.S. BTW, I used Text::Autoformat for the first time on this very email.
> Thanks Damian!
You're most welcome. I note that you didn't use it on the P.S. itself,
as Autoformat would have given you:
> P.S. BTW, I used Text::Autoformat for the first time on this very
> email. Thanks Damian!
As, indeed, it just did! ;-)
Damian