Re: RFC 171 (v2) my Dog $spot should call a constructor implicitly
[email protected] (Bart Lateur)
| Newsgroups | perl.perl6.language.objects |
|---|---|
| Organization | MediaMind |
| Message-ID | <[email protected]> |
On 01 Sep 2000 10:22:49 +0100, Piers Cawley wrote:
>> My previous concerns have not been adressed:
>> - There may not be a default constructor
>> - This makes creations of Singleton classes impossible
>> - There is a good reason to created typed, but undef, references
>> and fill them in later.
>
>And then there's:
>
> - Makes factory methods impossible.
> - Conveniently forgets all about polymorphism.
>
>It's *horrible* I tell you. *HORRIBLE*
I haven't followed this discussion up too closely, as the subject
doesn't really interest me. However, I have a few outsider remarks.
First: I don't like the idea of some user supplied code being called
whenever you declare a new variable, *unless* the author of the class
created a sub *especially written* for this purpose.
Suppose all you want is a variable that can reference existing Dog
objects, I definitely do not want that a new object that I don't need is
created, every time I get to the declaration.
Do you really want:
for (1..1000) {
my Dog $spot;
}
to create 10000 unused Dog objects? Ugh! (not "Ug")
Furthermore, I think it would be rather neat if
my Dog $spot;
print ref $spot;
would indeed print "Dog". But that is as far as it should go. At worst,
in special cases (with "use Fields;", for example), it may be
initialized to an empty but pre-keyed blessed "hash". Well, that is in
the view of current class implementation practices. If the objects
internals for Perl6 become radically different, these ideas should be
But I agree that anything beyond that is simply horrible. You'll only
drive more people *away* from OO, because it generates so horribly
inefficient code. If you want a constructor called, than FGS *call* a
constructor. Maybe you can reduce the syntax necessary to do that, but
please don't do it behind our backs.
--
Bart.