in reply to Re^8: Scalar context of slice (myth)
in thread Scalar context of slice

Your snippet doesn't prove that, but -MO=Concise does.

Damn it! You stole my proof of proof :) I have exactly that on my terminal all ready to c&p.

But the list operator doesn't return a list in scalar context.

I never said it did?

No reduction occurs, default or otherwise.

If I code:

sub x{ wantarray ? 'fred' : @_[ 0 .. $#_ ]; } print x( 1, 2, 3 );; fred print scalar( x( 1, 2, 3 ) );; 3

The list I supplied to x() and attempted to return, appears reduced,; is less (different) than it was; is no longer that same list. That's all I meant by "default reduction".

Ie. the thing that happens when a construct that would, in a list context, produce a 'list', appears in a scalar context.

Now, if you can find a better term for that than "list in a scalar context", enlighten away!

Actually, I think that thing, that I tried to avoid controversy by terming "reduction", can actually be seen happening:

if (GIMME != G_ARRAY) { if (++MARK <= SP) *MARK = *SP;

I'd read that (with licence) as: if we're not in an G_ARRAY context, if there are more than one items on the stack, then throw away all but the last item.

It's the builtin or operator that makes the choice, not the context.

The builtin or operator? Where? I don't see no or operators?


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."