Luke Palmer <[EMAIL PROTECTED]> writes:

> A synonym of:
> 
>     delete %h{foo};
> 
> would be
> 
>     %h{foo} = nonex;

This has the potential, if not documented exactly right, to create
bogus expectations.  Consider...

  $s = %h{foo} = nonex;

After deleting the foo key (and its value, if any) from %h this then
probably procedes to autovivify it when evaluating it as an rvalue; if
so, that may break the programmer's expectation, but if not, what is
assigned to $s -- obviously you can't assign nonex, because it isn't a
value.  Do we mutate it to undef?  Throw a runtime exception?  Remove
the entry for $s from the symbol table?

undef, odd though it is, is a value of sorts.  Not a terribly
meaningful value in many contexts, but a value.  And it knows how to
stringify, numify, et cetera.  The proposed nonex would do none of
those things, at least not without first autovivifying, at which point
it would no longer be nonex.

However, it might be possible to write the documentation so that it's
clear nonex isn't really a value, just syntactic sugar for deleting
the corresponding key.

-- 
$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}}
split//,"[EMAIL PROTECTED]/ --";$\=$ ;-> ();print$/

Reply via email to