> =head1 TITLE > > my Dog $spot should call a constructor implicitly > What, then, happens to the following code: my Dog $spot; if ($age > 12) { $spot = new Doberman(); } else { $spot = new Corgi(); } Would you seriously propose to create a Dog object, then wipe it in either branch if the if? Also, not every class of object can have a default constructor, not is that always desirable. Let's take a database handle as an example: my DBI::dbh $handle; if ($env eq 'test') { $handle = DBI->connect(... connect to test ...); } else { $handle = DBI->connect(... connect to prod...); }
- Re: RFC 171 (v1) my Dog $spot should call a constructo... Nathan Wiger
- Re: RFC 171 (v1) my Dog $spot should call a constructo... Michael Maraist
- Re: RFC 171 (v1) my Dog $spot should call a const... Matt Youell
- Re: RFC 171 (v1) my Dog $spot should call a c... Nathan Wiger
- Re: RFC 171 (v1) my Dog $spot should call... Michael Fowler
- Re: RFC 171 (v1) my Dog $spot should ... Nathan Wiger
- Re: RFC 171 (v1) my Dog $spot should call a const... Michael Fowler
- Re: RFC 171 (v1) my Dog $spot should call a const... Jonathan Scott Duff
- Re: RFC 171 (v1) my Dog $spot should call a c... Hildo Biersma
- Re: RFC 171 (v1) my Dog $spot should call... Piers Cawley
- Re: RFC 171 (v1) my Dog $spot should call a constructo... Hildo Biersma
- Re: RFC 171 (v1) my Dog $spot should call a const... Matt Youell
- Re: RFC 171 (v1) my Dog $spot should call a c... Michael Fowler
- Re: RFC 171 (v1) my Dog $spot should call a c... Hildo Biersma
- Re: RFC 171 (v1) my Dog $spot should call... Nathan Wiger
- Re: RFC 171 (v1) my Dog $spot should call... Matt Youell
- Re: RFC 171 (v1) my Dog $spot should call a const... Michael Fowler
- Re: RFC 171 (v1) my Dog $spot should call a const... Nathan Wiger
- Re: RFC 171 (v1) my Dog $spot should call a constructo... Piers Cawley
- Re: RFC 171 (v1) my Dog $spot should call a const... Nathan Wiger
- Re: RFC 171 (v1) my Dog $spot should call a c... Piers Cawley