> > A scalar context C would also need to DWIM, presumably by returning
> > "0, but true" in that (unusual) situation.
>
> Actually, given Damian's and my conversations last night, it looks like
> the first return arg from want() is going to be the context after all
> (since the
On Wed, 6 Sep 2000 05:33:27 +1100 (EST), Damian Conway wrote:
>A scalar context C would also need to DWIM, presumably by returning
>"0, but true" in that (unusual) situation.
I don't understand the existence of that phrase, and the fact that it
doesn't give a warning when used in numerical cont
Damian Conway wrote:
>
>> >if ( ($num_to_return) = want 'LIST' ) {
>> > # do stuff
>> >}
>>
>> $num_to_return would be zero, but the assignment would cause the
>> if() to be true.
>
> A scalar context C would also need to DWIM, presumably by retu
> >if ( ($num_to_return) = want 'LIST' ) {
> > # do stuff
> >}
>
> And more correct as I would assume that
>
> () = some_func();
>
> $num_to_return would be zero, but the assignment would cause the
> if() to be true.
A scalar context C
On Tue, Sep 05, 2000 at 11:16:48AM +1100, Damian Conway wrote:
>> By RFC 21, it looks like the call would be
>>
>>if ( want 'LIST' ) {
>> $num_to_return = want;
>> # do stuff
>>}
>
> or, more efficiently:
>
>if ( ($num_to_return) = want 'LIST'
> By RFC 21, it looks like the call would be
>
>if ( want 'LIST' ) {
> $num_to_return = want;
> # do stuff
>}
or, more efficiently:
if ( ($num_to_return) = want 'LIST' ) {
# do stuff
}
> However, at one time the discussion ha
Damian Conway wrote:
>
> That's indeed precisely what I meant. In fact, all list-returning built-ins
> ought to be optimized this way.
I think we're pretty much agreed on this point, but I have a tangential
question about want().
By RFC 21, it looks like the call would be
if ( want 'LIST' )