![]() |
|
"be consistent" | |
PerlMonks |
Re^4: OO systems and Perl 5 (Was: Recap: Future of Perl 5)by RonW (Parson) |
on Aug 31, 2018 at 00:04 UTC ( #1221412=note: print w/replies, xml ) | Need Help?? |
Semantically, you are right. But, that is not the issue Ovid raised in Recap: The Future of Perl 5. In his proposal, Ovid seeks to reduce the number of required steps and simplify the syntax in Perl 5's OO system. As to why I said Python's OO system seems to have changed since Larry stole from it, see the Python 3 example:
__init__ is called with an already "blessed" ref to an already allocated container. __init__ only sets values to the objects's fields. The 1-to-1 translation to Perl would be (using signatures to reduce "noise"):
Even if we make __init__ more Perl-ish (still using signatures):
Ovid would still point out that Perl is requiring the programmer to perform 2 extra steps: Allocate the container and create a blessed reference to the container. I don't know which version of Python Larry stole the OO system from, so I don't know what Larry changed. But, at least to me, Perl 5's classes look more like Smalltalk classes than Python 3 classes.
In Section
Meditations
|
|