On Fri, Sep 01, 2000 at 11:58:20AM +0200, Bart Lateur wrote:
> 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.

And that's what the RFC states.  If the author of Dog doesn't provide a
suitable object constructor, and the user uses my Dog $spot, a fatal
exception is raised.

 
> 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")

Then I would say: don't do that.

    for (1 .. 1000) {
        my $spot;
    }

or maybe, for some optimization:

    for (1 .. 1000) {
        my $spot isa(Foo);
    }


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

Well then, that's one nay vote.  :)


Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

Reply via email to