FAQ

Re: [ID 20000308.003] bug in the 'exists' function

Joshua N Pritikin
Mar 12, 2000 at 8:40 pm

On Sat, Mar 11, 2000 at 11:37:38PM -0500, jmm@pickering.elegant.com wrote:
Ilya Zakharevich <ilya@math.ohio-state.edu> writes:
John Macdonald writes:
The first rule, though, would have to unstrike the fear from our hearts.
Avoiding auto-vivification should not short-circuit subscript evaluation.
How could it?
If the compiler is being changed so that in an rvalue context,
no autovivification occurs (instead of the current situation
where the terminating auto-vivification does not occur but
earlier ones do), then an "obvious" optimization would be to
short-circuit evaluation of subscript index values after the
initial undefined one was found:

@a = ( 1 );
$x = $a[2][$i+$j];

As soon as the index 2 is used, the result of the right hand side
is known to be undef and it is tempting to skip evaluating $i+$j
since that result will have no effect. But if it were $i++
instead, there is a side-effect and short-circuiting the
side-effect would be bad. As Tom worried, it would make it
difficult to write correct programs or understand programs, since
you might not know until run-time just where this short-circuit
would be applied.
Isn't this something that can be addressed in Topaz?

--
"May the best description of competition prevail."
via, but not speaking for Deutsche Bank
reply

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post

1 user in discussion

Joshua N Pritikin: 1 post