develooper Front page | perl.moose | Postings from September 2009

Fwd: Specifying exact type

Thread Previous | Thread Next
From:
Chris Prather
Date:
September 3, 2009 14:10
Subject:
Fwd: Specifying exact type
Message ID:
12b83b2d0909031410n67f9ebe0mdcda3913e0fdaaaa@mail.gmail.com
I missed the list ... why doesn't google to reply to all anymore? *sigh*


---------- Forwarded message ----------
From: Chris Prather <perigrin@gmail.com>
Date: Thu, Sep 3, 2009 at 5:10 PM
Subject: Re: Specifying exact type
To: Jesse Luehrs <doy@tozt.net>


On Thu, Sep 3, 2009 at 4:41 PM, Jesse Luehrs<doy@tozt.net> wrote:
> On Thu, Sep 03, 2009 at 01:33:58PM -0700, Yuri Shtil wrote:
>> If I say isa => 'Class', then it will include all derived classes.
>> How do I exclude derived classes?
>>
>> Do I need a subtype like:
>>
>> subtype TopClassOnly => as 'Class' => where {blessed($_) eq 'Class'};
>
> First of all, don't do that, and second of all, yes.
>
> -doy
>

I think Jesse means "Why would you want to exclude derived classes?
One of the main points to object orientation is Subtype Polymorphism
... meaning derived classes can be substituted for main classes, why
would you want to throw that away?"

and

"Yes if you insist on shooting yourself in teh foot, that is the
proper way to take aim."

-Chris

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About