4 ms·
Nope. * Some of the best languages for producing an internal DSL (dialects) don't have a "native MOP". For eg. Lisp, Rebol or Forth. * Python & Ruby don't ha
by draegtun 13y ago
Nope.
* Some of the best languages for producing an internal DSL (dialects) don't have a "native MOP". For eg. Lisp, Rebol or Forth.
* Python & Ruby don't have native MOP's anyway :)
NB. I wonder what you mean by "native MOP" is baked-in OO? Python & Ruby OO systems do come with MOP like abilities. However for full blown (metacircular) MOP (http://en.wikipedia.org/wiki/Metaobject#Metaobject_protocol http://en.wikipedia.org/wiki/Metaobject#Metaobject_protocol) you need to look at things like CLOS & Perl's Moose/Class::MOP.
- danellis 13y agoBy "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.
- draegtun 13y agoA 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).