On Monday, March 31, 2003, at 07:39 AM, Piers Cawley wrote:
Argument initializations
Michael Lazzaro summarized the various different and proposed assignment
operators available in Perl 6, including a proposed "::=" for 'only
assign to uninitialized variables'. Michael wondered how these could be
used in method signatures and proposed some changes to the signature
system as set out in Apocalypse 6. People were dubious about this, with
Damian saying "I don't think that allowing 20 different types of
assignment in the parameter list of a subroutine actually helps at all."
I'm not sure Michael is convinced yet.
Nah, I'm convinced that nobody likes the putting-more-initializers-in-the-sig idea, so it can die. And I'm convinced that we can't use ::= for the purpose of if-uninitialized, because it's not consistent with the other meaning.
I'm still hoping rather desperately for a if-uninitialized op in general, even if only for hashes, because the difference between "present but undefined" and "not present" is rather crucial for some common algorithms. But I have no idea what to propose calling it, which is a bit of a pickle. :-/
$h{ k } = 'blah'; # always $h{ k } //= 'blah'; # if not defined $h{ k } ///= 'blah'; # if not exists ???
MikeL