Re:In Praise of Perl 5
by draegtun on Monday March 03, 2014 @05:49AM
(#7333051)
A bit of apple & oranges going on here because you don't need Moose (or more precisely Class::MOP) to simulate Python metaclasses and descriptors. Because you could, if you so wished, build a Python metaclasse/descriptor based OO system in Perl's native OO.
To clarify things:
* Python comes with a pre-defined OO system with metaclasses/descriptors for dynamically building new Python classes/objects.
* Perl comes with OO lego blocks from which you build you own OO system.
* Class::MOP is a metacircular MOP mainly written in Perl using these lego blocks (it's turtles all the way down).
* A MOP (like Class::MOP) provide an API for building & managing extendable OO systems.
* Moose is an advanced OO system built on Class::MOP.
* Moose provides features like Roles, Method Modifiers, lazy attributes and many more.
There have been two attempts, that I know of, to bring (a subset of) Moose to Python:
To clarify things:
* Python comes with a pre-defined OO system with metaclasses/descriptors for dynamically building new Python classes/objects.
* Perl comes with OO lego blocks from which you build you own OO system.
* Class::MOP is a metacircular MOP mainly written in Perl using these lego blocks (it's turtles all the way down).
* A MOP (like Class::MOP) provide an API for building & managing extendable OO systems.
* Moose is an advanced OO system built on Class::MOP.
* Moose provides features like Roles, Method Modifiers, lazy attributes and many more.
There have been two attempts, that I know of, to bring (a subset of) Moose to Python:
There have been many clones of Moose to other languages as well, including Ruby (multiple clones/ports), Javascript & Lua.For something comparable to Moose/Class::MOP then have a look at CLOS (Lisp).