Re: RFC 188 (v1) Objects : Private keys and methods

[email protected] (Damian Conway) Thu, 7 Sep 2000 10:13:03 +1100 (EST)
Newsgroups perl.perl6.language.objects
Message-ID <[email protected]>
   > >	print keys %hash, "\n";
   > >	exists $hash{key}{subkey};
   > >	print keys %hash, "\n";
   > 
   > >Or did that get fixed when I wasn't looking?
   > 
   > No, the -> operator has not been changed to do lazy evaluation.

That's not required. All that is necessary is for C<exists> nodes
in the op tree to propagate a special non-autovivifying context to 
subordinate nodes.

E.g. exists $hash{key}{subkey}

		exists
		   \
		  entry
		  /   \
	      entry   "subkey"
              /   \
	  %hash   "key"


Is preprocessed to:

		exists
		   \
		  entry(na)
		  /       \
	      entry(na)   "subkey"
              /      \
	  %hash(na)  "key"

which prevents %hash from autovivifying, which causes the left-most
branch to fail (without autovivifying) when asked for "key", which in
turn causes the entire <exists> to fail without autovivifying.


   > I just don't like reading "exists causes autovivification" when it
   > doesn't.

Sorry, I was being philosophically sloppy. A call to C<exists> can
*result* in autovivification (of something), though it does not itself
*cause* autovivification.

;-)


Damian