develooper Front page | perl.perl6.language | Postings from June 2004

Re: Semantics of vector operations (Damian)

Thread Previous | Thread Next
From:
Damian Conway
Date:
June 14, 2004 12:38
Subject:
Re: Semantics of vector operations (Damian)
Message ID:
40171197.6070401@conway.org
Scott wrote:

> I'm just waiting for Damian to speak up :-)

I'm not at all comfortable with the notion of junctions as lvalues.
I've *always* considered a junction to be a special kind of constant, just as 
a number or a string or a reference is.

I have trouble with junctive lvalues because I think they lead to 
unexpected/unpredictable behaviour. For example, the "predicate" associated 
with a junction is only invoked when that junction is involved in a boolean 
test of some kind, so the (hypothetical):

	all($x, $y, $z) = 1;
	any($x, $y, $z) = 1;
	one($x, $y, $z) = 1;
	none($x, $y, $z) = 1;

would (hypothetically) all do the same thing (i.e. independently assign 1 to 
each of the three scalar variables). That makes the last three versions 
nothing but obfuscatory in my view.

So, at very best, we'd have to restrict lvalue junctions to conjunctions.

And there seems to be very little benefit even in that restricted form, 
especially when you consider that:

	all($x, $y, $z) = 1;
         all(@foo) = 2;

are hardly any better than the existing solutions:

	$x = $y = $z = 1;
         $_ = 2 for @foo;

and no better at all than the Perl 6 distributive solutions:

	($x, $y, $z) »= 1;
	@foo »= 2;

So, on balance, I feel that lvalue junctions are more trouble than they're worth.


Damian





Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About