Show quoted text> I can't say I'm massively fond of it either. It has no parallel in
> existing Perl 5 code. You can't for example do:
>
> my $foo = ;
>
> But this is documented syntax for Perl 5.19.9.
Yes, all properly documented and official-looking, but that doesn't keep it from being any less STUPID. :-/
Show quoted text> At first I was like "no no no, that's just turning a user mistake into
> syntax"
> and now I'm like "hey, that's a really intuitive way to declare an
> optional
> variable without needing extra syntax".
>
> My thinking goes like this. Variables should be required by default (I
> hope
> 5.20 does this). Optional variables should have defaults, so why not
> make the
> syntax for declaring something optional to be the same as declaring a
> default?
>
> PRESTO! No more need for the extra $foo? syntax. One less bit of
> special syntax
> for users to remember. And it forces the function author to think
> "hey, this
> argument should have a default".
I remain unswayed. :-/ `$foo=` just looks stupid. If you really don't like the `$foo?` syntax, you're perfectly free to write `$foo = undef`, which is a) legal, b) obvious, and c) already working in all signature implementations. The only downside is, it's (at least) 5 more characters than `?`.
Show quoted text> As to the argument that there's no precedent for '$foo=' in Perl,
> there's a lot
> more precedent than '$foo?'.
I disagree, since I consider Perl 6 to be Perl (even though I know that's not always a popular viewpoint). My main point is, the very first time I ever saw `$foo?` (which was in a Perl 6 something-or-other--most likely either Apocalypse or Exegesis), I knew exactly what it meant. The first time I saw `$foo=` I thought: WTF is that abomination??
I'm just sayin'. ;->
Anyhow, all we're quibbling about is whether to document it or not, and I can't realistically mount much of a defense against doing so, I suppose. But let me sulk on it for a bit longer. :-D