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

Re: [FWP] Testing list?



At 03:12 PM 1/2/00 -0500, Uri Guttman wrote:
>the definition of ||= requires the lvalue be readable as an rvalue of
>the same type. but assigning to @a is not the same as reading @a in a
>scalar context. that is the problem with arrays and ||=. it is not a
>problem of propogating context but that || evaluates in scalar context
>only. and the assignment propogates an array context. that is a
>contradiction so it is an illegal operation.

But if || propagated its context to the left hand side as well then there 
would be no contradiction.

>||= can't expand the first into the second. it is inherently a execution
>shortcut as well as a syntactical one. think about its origins in c [snip]
>it was done to make the code more efficient as much as syntactic
>shortcuts. they knew that they could add a value to a location without
>reading in the location first.

I do take your point, but it isn't an argument for ||= on arrays being 
either undesirable or impossible, merely difficult.

--
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