Re: Change ($one, $two)= behavior for optimization? (was Re: RFC 175 (v1) Add Clist keyword toforce list context (like Cscalar))

2000-09-05 Thread Graham Barr
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' ) {

Re: Change ($one, $two)= behavior for optimization? (was Re: RFC 175 (v1) Add Clist keyword toforce list context (like Cscalar))

2000-09-05 Thread Damian Conway
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 Cwant would

Re: Change ($one, $two)= behavior for optimization? (was Re: RFC 175(v1) Add Clist keyword toforce list context (like Cscalar))

2000-09-05 Thread Nathan Wiger
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 Cwant would also need to DWIM, presumably by returning "0,

Re: Change ($one, $two)= behavior for optimization? (was Re: RFC 175 (v1) Add Clist keyword toforce list context (like Cscalar))

2000-09-05 Thread Bart Lateur
On Wed, 6 Sep 2000 05:33:27 +1100 (EST), Damian Conway wrote: A scalar context Cwant 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

Re: Change ($one, $two)= behavior for optimization? (was Re: RFC 175(v1) Add Clist keyword toforce list context (like Cscalar))

2000-09-05 Thread Damian Conway
A scalar context Cwant 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 then

Re: Change ($one, $two)= behavior for optimization? (was Re: RFC 175 (v1) Add Clist keyword toforce list context (like Cscalar))

2000-09-04 Thread Nathan Wiger
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' ) {

Re: Change ($one, $two)= behavior for optimization? (was Re: RFC 175 (v1) Add Clist keyword toforce list context (like Cscalar))

2000-09-04 Thread Damian Conway
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 had