Michael Fowler wrote:
>
> Regarding the STORE call, if RFC 159 gets adopted, sure, why not. I'll
> mention that alternative in the RFC's next version.
Cool.
> I need to mention the:
>
> my int $x;
> my int $i = 4;
> my int ($x, $y, $z) = (4, 5, 6);
>
> syntax in the RFC. It describes more of the intent behind the change.
Great, yeah this is where it's really powerful.
> Sure, the my Dog $spot (@args) looks neat, but it's not any less complex
> than a normal constructor call; if anything, it's moreso. There's no current
> precedent in Perl for such syntax, and I'm loathe to add it without more
> reason.
Yeah, I wrote that on a lot of beer. ;-) The more I think about it, if
we went that route it should look like this:
my Dog (@args) $spot = "Spot"; # $spot = Dog->CREATE(@args);
# $spot->STORE("Spot");
That is, the args follow the class name. Then it's really just a
left-side indirect object syntax:
my $q = new CGI (@args);
my CGI (@args) $q;
my($x, $y, $z) = new int (@args);
my int (@args) ($x, $y, $z);
Then I think there is a decent precedent for it. It's an option, at
least. Parsing would be tricky though, at least in the second case.
-Nate