Re: RFC 171 (v1) my Dog $spot should call a constructor implicitly

[email protected] (Nathan Wiger)
Newsgroups perl.perl6.language.objects
Message-ID <[email protected]>
Matt Youell wrote:
> 
> > mainstream OO languages go).  It looks like Dog could be a type of String
> > subclass.
> 
> That was my first thought as well. Besides, I'd rather type:
> 
>     my Dog $spot("Spot");
> 
> Which says everything that needs to be said without any repetition, and it's
> fairly intuitive.

Exactly. I've got to start being more verbose in my examples. Here are
some different examples and how I personally think they would work given
this RFC and RFCs 159 and 161:

   my Dog $spot;              # $spot = Dog->CREATE
   my Dog $spot (@args);      # $spot = Dog->CREATE(@args)
   my Dog $spot = "Spot";     # $spot = Dog->CREATE;
$spot->STORE("Spot")
   my Dog $spot (@args) = "Spot";   # $spot = Dog->CREATE(@args);
                                    # $spot->STORE("Spot");

Hopefully that's clear enough. And as everyone's noted, nobody's
claiming you can't do this:

   my $spot = Dog->new("Spot", { @args });

Or something like that, if you like it better.

-Nate
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.