On Wed, Mar 16, 2005 at 05:33:04PM +0800, Autrijus Tang wrote:
: Also, how does that philosophy fit with the bare thunking in array
: slices, as listed in A05? 
: 
:     @3d_slice = @array[ !($_ % 2) ; 0..9:3; ?test($_) ];

If I recall, the discussions around S9 indicated that it might be a bad
idea to enable that by default, so maybe we could enable such behavior
by marking the array or otherwise declaring a pragma to enable it.  The
concern was that it would foil the optimizer if it could not
assume that the subscripts of @array[$x;$y;$z] are integral, and
if the parameters could contain thunks, it can't assume that.

Since it's not a problem for syntax that can be recognized at compile
time, your slice above might be allowed if you "declare" the thunks
with curlies:

    @3d_slice = @array[ {!($_ % 2)}; 0..9:3; {?test($_)} ];

We could conceivably allow explicit boolean operators to be interpreted
as thunks, but arguably, if someone passes a boolean as a subscript,
they might actually be wanting to subscript on 0 or 1.  And whether
a particular operator returns boolean is kind of a fuzzy set.
So let's stick with the explicit closure rule for now.  Another of
those things we can relax later, if we see a way to do it cleanly.
Or there's always the pragma approach to enable the pessimization.

Larry

Reply via email to