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

Re: [FWP] Testing list?



>>>>> "RJK" == Ronald J Kimball <rjk@linguist.dartmouth.edu> writes:

  RJK> @a ||= (1, 2);

  RJK> This is a compile-time error.

  RJK> Should it be legal code?  Justify your position.

i see what you are trying to do there but does it make sense? || puts
scalar contexts on its arguments so:

	$n = @a || 3 ;

would assign the length of @a or 4 to $n.

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.

so it makes sense to me for it to be a compile time error.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com

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