in reply to Uninitialized or not?

As tye says this is an example of autovivification at work. And furthermore the timing is interesting as just the other day Nick Clark started a thread on p5p about this. He (and I) believe that autovivification should be made more consistent. However not the direction that tye suggest, rather the opposite. Anyway the thread is here.

--- demerphq
my friends call me, usually because I'm late....

Replies are listed 'Best First'.
(tye)Re2: Uninitialized or not?
by tye (Sage) on Nov 27, 2002 at 22:05 UTC

    That is not the opposite direction. I want an option.

    What would make sense would be to separate 'use strict "refs"' into two options, one for symbolic references and one for undefined references, so you could ignore errors from $u->[0] without having to autovivify (the difference being whether you want simply evaluating $u->[0] to set $u -- I can see wanting to ignore that error, but I don't see much point in having simple evaluation silently setting things).

    Add to this an option to disable autovivification in left-hand context and we'd all be happy.

            - tye
      Well, i can see your idea about strict being useful for sure. But for me the one thing id like to see is that @{undef} returns 0 or () in a rhs context and not throw an error. If I have to twiddle an option then fine. If that means it gets autovivified then thats fine too. Although id prefer that things dont get autovivified on read. Even multilevel accesses.

      :-)

      --- demerphq
      my friends call me, usually because I'm late....