4 ms·
I prefer defining things to tweaking them, so I don't find dynamic metaprogramming (CLOS) to be a good enough substitute for static metaprogramming (macros), an
by catnaroek 10y ago
I prefer defining things to tweaking them, so I don't find dynamic metaprogramming (CLOS) to be a good enough substitute for static metaprogramming (macros), and Racket's macro system is light years ahead of Common Lisp's. YMMV, of course.
- lispm 10y agoI don't think macros are a good way to implement or even extend object-oriented languages. So I don't think static macroprogramming is a good substitute for a meta-object system.
- catnaroek 10y agoGive me a compelling reason to design programs in an object-oriented way. Just to be clear, I don't find the ability to subvert existing definitions particularly attractive, because it undermines my ultimate goal to actually prove things about my programs. --- @lispm, I have reply here because I'm temporarily unable to make new posts. > A large share of contemporary software is written in an object-oriented way. Sure, but how does that contradict my original assertion that Racket's mechanisms for extending and redefining the language are more principled than either Common Lisp's or Smalltalk's? --- > Could it be that you just don't like/use/need/want the object-oriented ways to extend those languages and thus these mechanisms are not 'principled'? You're right that there's an aesthetic component: I don't have much taste for object-orientation. But this isn't just me being close-minded: I would take object-orientation far more seriously if someone could provide an interpretation of object-oriented programs as mathematical objects with nice properties. > How are Racket's mechanisms for extending and redefining the language more principled Racket's macro system is based on a theory of how to macro-expand in a capture-avoiding way, ruling out by construction errors that are very difficult to debug when doing similar things in Common Lisp. And macro systems are more principled than MOPs in that macros are purely static devices: you (re)define the language first, and you use it later. > Especially since Racket provides some of that, too -> Swindle. Object-orientation in Racket is completely opt-in. You don't have to use it if you don't want to, and, in fact, I just don't use it... > Is the CLOS MOP not principled? Why? ... OTOH, in Common Lisp it's far more pervasive. Everything is an object and has a class, and classes can be tampered with in arbitrary ways, precisely using the MOP. How can then you prove anything interesting about how instances of a class will behave under all circumstances? The essence of abstraction is to ignore implementation details, and concentrate on, well, abstract properties. A MOP achieves the opposite thing: it makes all implementation details available everywhere, complicating the problem of abstraction enforcement.
- lispm 10y ago> Give me a compelling reason to design programs in an object-oriented way. Just to be clear, I don't find the ability to subvert existing definitions particularly attractive, because it undermines my ultimate goal to actually prove things about my programs. Probably there are other software developers with other requirements. A large share of contemporary software is written in an object-oriented way. Or is OOP a big swindle??? http://docs.racket-lang.org/swindle/ http://docs.racket-lang.org/swindle/
- lispm 10y ago> Sure, but how does that contradict my original assertion that Racket's mechanisms for extending and redefining the language are more principled than either Common Lisp's or Smalltalk's? Your original claim was "Unlike other languages that also advertise malleability (Common Lisp, Smalltalk, etc.), Racket is malleable in principled ways". Now you added 'more'. We can discuss which you or me like more, but you claimed that Smalltalk and Common Lisp can't be extended in 'principled' ways. Could it be that you just don't like/use/need/want the object-oriented ways to extend those languages and thus these mechanisms are not 'principled'? How are Racket's mechanisms for extending and redefining the language more principled than for example Common Lisp's CLOS and the Meta-object protocol for CLOS? Especially since Racket provides some of that, too -> Swindle. I'm using for example LispWorks, a Common Lisp, which uses CLOS throughout to make the language flexible and extensible. Is the CLOS MOP not principled? Why?
- lispm 10y ago> Everything is an object and has a class, and classes can be tampered with in arbitrary ways, precisely using the MOP. CLOS provides specific and well-designed mechanisms to extend the language via the MOP providing protocols for: * metaobject initialization * class finalization * instance structure * funcallable instances * generic function invocation * dependent maintenance > The essence of abstraction is to ignore implementation details, and concentrate on, well, abstract properties. That's why CLOS has meta-classes, meta-objects and generic functions. They provide the facilities for abstraction.
- 10y ago