Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

By "native MOP" I really mean things like Python's metaclasses and descriptors (and whatever Ruby's equivalents are called), as opposed to an add-on library to simulate them like Moose.



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:

    https://pypi.python.org/pypi/bullwinkle/0.3.6
    https://pypi.python.org/pypi/elk/0.2
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).




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: