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

[email protected] ("Matt Youell")
Newsgroups perl.perl6.language.objects
Organization Silicon Spike
Message-ID <[email protected]>
Perhaps there is some way to allow for both syntaxes? For example, in C++ I
can say:

    string str();

or:

    string* str = new string();

Depending on my needs.

So perhaps sometimes in Perl we could say:

    my Dog $spot = undef;    # Automagically knows to be a Dog ref instead
of a Dog object because of the undef.
    if ($age > 12) {
         $spot = new Doberman();
     } else {
         $spot = new Corgi();
     }


Matt
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.