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

Re: Semantics of vector operations (Damian)

Thread Previous | Thread Next
Damian Conway
June 14, 2004 12:38
Re: Semantics of vector operations (Damian)
Message ID:
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.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About