[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Testing list?



At 12:12 PM 1/2/00 -0500, Uri Guttman wrote:
>so your code is really:
>
>         @a = @a || (1, 2) ;
>
>but with both @a's trying being the same thing (which is what op= does)
>which is a contradiction since the left @a is the array for assignment
>and the right @a being the length which is not assignable.
>
>so you have a scalar and array context being applied to @a at the same
>time. not nice.

I don't see why that should be a show-stopper.   This is really about 
'propagating context', which happens, for instance, in the hook operator:

         @c = $scalar_condition ? @a : @b;

And so the above can be written as

         @a = @a ? @a : (1, 2);

which doesn't have any problem evaluating @a in multiple contexts.  It's 
merely a question of what would break if || propagated context as well.  I 
asked MJD about it some time ago and he thought that the reason was due to 
the way it would cause an array to be evaluated as a boolean.



--
Peter Scott
Pacific Systems Design Technologies


==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe