Chris Prather wrote:
I missed the list ... why doesn't google to reply to all anymore? *sigh*


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


On Thu, Sep 3, 2009 at 4:41 PM, Jesse Luehrs<d...@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
I am confused with "First of all, don't do that".

What is wrong in excluding some of the derived classes from a subtype definition? It has nothing to do with inheritance/Polymorphism. I just want to limit what can be saved in the attribute.

--

Yuri

Reply via email to