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

[email protected] (Piers Cawley)
Newsgroups perl.perl6.language.objects
Message-ID <[email protected]>
Perl6 RFC Librarian <[email protected]> writes:

> This and other RFCs are available on the web at
>   http://dev.perl.org/rfc/
> 
> =head1 TITLE
> 
> my Dog $spot should call a constructor implicitly

Eeeewwwwww. Most of the time I use 'my Dog $spot' is along the lines
of:


    package Dog;

    sub bark {
        my Dog $self = shift;
        print $self->name, " barks!\n";
    }
 
    package Main;

    my Dog $spot = Dog::Dalmation->new(name => 'Spot');
    $spot->bark;
    

Or what about:

    my Dog $patches = $dog_pound->get_cute_stray;

There's a whole host of occasions when you want 'my Dog $spot' but you
*don't* want $spot to be set to Dog->new.

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