<div dir="ltr">(with apologies to Ilia for sending it to him first instead of the list... damn reply button)<br><br>Side note from my Lightning talk.<br><br>It came up at one point why when I was defining an attribute I did this:<br>
<br>has 'x' => (<br> is => 'rw',<br> isa => 'HashRef',<br>
default => sub { +{} },<br>);<br><br>In
Moose, if you're defining a type with a default that is not a scalar,
you have to use an anonymous sub. But in all the Moose examples for
hashrefs, you see the "sub { +{} }". The good Abbot Beamish questioned
me on this peculiar plus sign and I guessed was because the Perl
interpreter needed to disambiguate the use of the braces ( a BLOCK or a
HASHREF ). <br>
<br>I just quizzed Richard to see if this was the case and
double-checked perlref and this is indeed the case. Apparently Richard
remembers asking Randal about this once and it was a weird kink that no
one could stop the interpreter from screwing up so they decided to add
the plus. sub { return {}; } would have been what I myself would have
done initially but I went with what I saw.<br>
<br>For your reference and mine, you'll find it under point 3 here:<br><br><a href="http://perldoc.perl.org/perlref.html#Making-References" target="_blank">http://perldoc.perl.org/perlref.html#Making-References</a><br>
<br>Thanks,<br>
Dave</div>