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.
Exactly. Even then, the arguments must match.
So, if Dog::new() takes one argument, and has also been declared to
be the 'implicit constructor', then:
my Dog $spot;
is a syntax error.
my Dog $spot = 'hungry';
is allowed.
> 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")
Agree. I think the RFC confuses the notion of object with the notion of
reference.
> 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.
Agree. Either learn from C++ or don't go this route.
Hildo
- Re: RFC 171 (v2) my Dog $spot should call a ... Tom Christiansen
- Re: RFC 171 (v2) my Dog $spot should cal... Michael Fowler
- Re: RFC 171 (v2) my Dog $spot should call a ... Michael Fowler
- Re: RFC 171 (v2) my Dog $spot should call a constructor i... Hildo Biersma
- Re: RFC 171 (v2) my Dog $spot should call a construc... Michael Fowler
- Re: RFC 171 (v2) my Dog $spot should call a cons... Hildo Biersma
- Re: RFC 171 (v2) my Dog $spot should call a ... Michael Fowler
- Re: RFC 171 (v2) my Dog $spot should cal... Michael Fowler
- Re: RFC 171 (v2) my Dog $spot should call a construc... Piers Cawley
- Re: RFC 171 (v2) my Dog $spot should call a cons... Bart Lateur
- Re: RFC 171 (v2) my Dog $spot should call a ... Hildo Biersma
- Re: RFC 171 (v2) my Dog $spot should call a ... Michael Fowler
- Re: RFC 171 (v2) my Dog $spot should call a ... Damian Conway
- Re: RFC 171 (v2) my Dog $spot should cal... Nick Ing-Simmons
- Re: RFC 171 (v2) my Dog $spot shoul... David E. Wheeler
- Re: RFC 171 (v2) my Dog $spot should cal... Piers Cawley
- Re: RFC 171 (v2) my Dog $spot shoul... Michael Fowler
- Re: RFC 171 (v2) my Dog $spot s... Piers Cawley
- Re: RFC 171 (v2) my Dog $spot s... Nathan Wiger
- Re: RFC 171 (v2) my Dog $spot should call a cons... Nathan Wiger
- Re: RFC 171 (v2) my Dog $spot should call a ... Piers Cawley
