in reply to Re^4: Why does exists cause autovivication?
in thread Why does exists cause autovivication?

As I noted in my reply, the way to make it happen is to give op-nodes the option of refusing to autovivifying. "exists EXPR" gets generated into a (sub)tree of op-nodes the root of which does the "exists" part. So the implementation would cause the compilation into op-nodes to treat "exists EXPR" like it was "do { no autovivify; exists EXPR }" (but, no, it wouldn't be implemented like a source filter).

Of course, the easiest way to implement "no autovivify" is to make attempts to autovivify fatal errors so the easy implementation would actually have to interpret "exists EXPR" as "eval { no autovivify; exists EXPR }", which adds a run-time overhead (and the C code that implements it would need to only "catch" fatal errors due to refusal to autovivify).

So implementing "no autovifiy" makes sense as a first step, especially since I consider it more useful than a magical exists. That requires defining a new lexically scoped "hint" bit and finding all places in the Perl source code that implement auto-vivification and teaching them to obey that bit.

- tye        

  • Comment on Re^5: Why does exists cause autovivication? (how)