Simon Cozens writes:
: On Mon, Apr 23, 2001 at 11:48:35AM -0700, Larry Wall wrote:
: > : @foo = @( a + b ); # element by element add of @a and @b
: > I expect that's be written:
: >
: > @foo := @a + @b;
:
: Two different assignment operators? I can understand the intent, but this kind
: of difficult-to-remember special-casery is the sort of thing that *already*
: gives Perl a bad press.
It's not special casery. It's a fundamentally different kind of
assignment, such as you find in Ruby, and the rules applied to the left
side of such an assignment will be identical to the rules applied to a
function prototype/signature. The := will assume it's assigning
scalar objects unless it's explicitly instructed otherwise.
: Think about the question "Does this vastly increase or vastly decrease the
: program-breaking potential of a mistake made by a novice Perl 6 programmer?"
I have thought about it a lot, actually. Why do you think this is
taking so long? :-)
: >From a trainer's point of view, having two operators which look very similar,
: are used for the same thing in various different languages, and do *almost*
: the same thing but not quite, is completely *asking* for confusion.
So teach 'em :=, and outlaw = with some kind of stricture. That'll
save a heap of newbie confusion with == too. The = would only be there
for compatibility anyway, when you want an old-fashioned Perl
assignment that attempts to dwim the list/scalar context. But it's
redundant, in the sense that function signatures will have sufficient
power to write the equivalent to = using := notation.
And I don't care if it looks like Pascal, so don't try that argument. :-)
Larry