Re: RFC 171 (v1) my Dog $spot should call a constructor implicitly
[email protected] (Jonathan Scott Duff)
| Newsgroups | perl.perl6.language.objects |
|---|---|
| Message-ID | <[email protected]> |
On Tue, Aug 29, 2000 at 11:04:26PM -0400, Michael Maraist wrote: > First greatly stylistic compatibilty. An inexperienced programmer would > see: > my Dog $spot = "Spot"; > > And become confused. It's totally unintuitive (at least so far as other > mainstream OO languages go). It looks like Dog could be a type of String > subclass. Why would the programmer become confused? In C++ (a mainstream OO language), if a Dog constructor was defined that took a string as an argument, the string would be auto-converted to a Dog. So, if this were adopted for Perl, the programmer would know that the class constructor for Dog would be called to instantiate $spot, then, because of the assignment, the Dog->STORE() method would be called. And if the programmer were inexperienced, it would be a perfect time for them to learn something. -Scott -- Jonathan Scott Duff [email protected]