develooper Front page | perl.perl6.porters | Postings from March 2000

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

From:
Joshua N Pritikin
Date:
March 12, 2000 12:40
Subject:
Re: [ID 20000308.003] bug in the 'exists' function
Message ID:
20000312154010.C753@eq1062.wks.na.deuba.com
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



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About