NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Abstract Classes (Score:1)
I suspect you mean
$_->is_abstractand not$self->is_abstract. Beyond that I think I need to know more of the context in which this is used.- Stevan
Re: (Score:1)
Also I think he needs the opening '(' for
{ ! ( /::BASE::/ || /::SUPER$/ ) }.Re: (Score:2)
Each method attempts to do the the same thing: return a list of non-abstract classes. The first method inspects class names and uses a heuristic to find out if they're abstract classes. The second method asks the classes if they're abstract classes. How this is used could vary, obviously. As an abstraction, there are any number of reasons why you might want a list of non-abstract classes.
hmm (Score:1)
Are they even equivalent? (Score:1)
That would require that you never have a concrete class inheriting from another concrete class, which feels like a very bad thing to bake in.
Of course, I don't know how those
::SUPERs get in there. It's possible they can only arise when the class is already known to be abstract; but that just makes the whole thing even more obscure.So, the second
:). I would probably want theis_abstractmethod to be a sprinkling ofsub is_abstract { 1 }and{ 0 }s rather than simply that expression, as well.Depends (Score:1)
Well that probably depends on a whole lot of things that aren't evident from the examples or your description.
So I have no clue.
Re: (Score:1)
Why not:
return grep { $_->can('new') } $self->domain_classes;
Also, it's somewhat silly to use the word "class" for something that's not a class. (An abstract class is not a class.) When you think "abstract class" and you are a Perl programmer, you really want roles.