Metaprogramming, Metaclasses and Metaobject Protocols by Raymond de Lacaze

In three distinct but related sections, Raymond de Lacaze presents and describes metaprogramming, metaclasses and the metaobject protocol.

Metaprogramming, is today somewhat synomous with the notion of programming with macros.  Ray describes in detail what macros are, how to write them correctly so that they are hygienic, how to debug them and when to use them. Examples are provided in Common Lisp. He also briefly describes what meta-programming looks like in other less homoiconic languages.

Metaclasses are described along with what they are used for and can accomplish. A specific use-case is examined in depth. This is done in the context of the Common Lisp Object System (CLOS) and a brief introduction to CLOS is provided.

Metaobject protocol leverages material from the seminal book "The Art of the Metaobject Protocol" (AMOP) and describes the problems that MOP's were designed to solve.  Ray explains how to design and implement a metaobject protocol for CLOS.  Specifically he examines code that implements the 'defclass' macro which is CLOS's class definition mechanism, and extends the implementation to support metaobject protocol functionality.

Finally, time permitting, Ray shares his personal ideas on what it means to have a meta protocol for Clojure and how it might be useful.

Pizza, beer and soft drinks generously provided by Meetup.

Join or login to comment.

  • David B.

    I updated my "CLOS" library for Clojure, so it now supports :before and :after methods, and is now more efficient; still at https://github.com/davber/clj-clos

    June 16, 2013

    • Jonathan R.

      Maybe you need to rename it. How about "CCOS: Completely Clojure Object System?"

      June 16, 2013

  • David B.

    Just for fun, I started to create a Clojure library that gives some of the CLOS flexibility w.r.t. method lookup and chaining.

    It can be found at https://github.com/davber/clj-clos

    The first version allows you to invoke 'call-next-method' within a method.

    2 · June 15, 2013

  • David B.

    One thing that irritates me a tiny bit with CLOS is that the method has to *be certain* there are more methods in the (call-specific) chain when issuing call-next-method. This is just silly, since we do not want a specific implementation to know what might come after it, if anything at all. In fact, the whole collapse of specialized logic and the chain crawling into the same code (inside the method) is a bit counter-meta-tive. Granted, in some cases, there are decisions coming up in the specialized logic affecting the crawling, but I argue that such cases should not be implemented via generic functions, but rather via some other and more explicit delegation means.

    June 13, 2013

    • Pierre de L.

      Well you can always write a method on the NO-APPLICABLE-METHOD GF. :-)

      Alternatively, though this is clearly an OVERKILL (IMHO), you could actually have a meta-class that changes that behavior.

      June 13, 2013

    • Pierre de L.

      Actually the wright to do thish fairly easily is to check for yourself if there is a next applicable method. The MOP certainly provides you the necessary introspective capabilities to do this so that you could actually have code of the form:

      (when (next-method-p (class-of <obj>))
      (call-next-method))

      where next-method-p is something you can write using MOP "primitives".

      June 13, 2013

  • David B.

    This is the THIRD Lisp event in a row I miss, last minute. Not good, and I apologize. Would love to have some metametaobject discussions soon.

    June 11, 2013

    • David B.

      In Orthogonal Programming, I tried to both describe the common aspects of the various methods or paradigms in this (meta meta) class, and to enumerate those instances, which includes Meta Programming, Generic Programming, Aspect-Oriented Programming and any kind of reflective system which only partly can be formally put in the Meta Programming category. Well, I will leave this for the new meetup, which I will start; perhaps I will call it Orthogonal Programming.

      1 · June 13, 2013

    • Pierre de L.

      Anytime you want to get together and discuss "all things meta" let me know. "Meta" is my middle name as well. I'd be particularly interested in how we could bring some of these ideas and paradigms to the Clojure community.

      June 13, 2013

  • Pierre de L.

    Slides from my talk are available here:

    http://www.slideshare.net/delaray/meta-objectprotocols

    June 12, 2013

    • mark p.

      appreciate it, had to split at "half time"

      June 12, 2013

  • Choy R.

    i learned a lot. great stuff.

    1 · June 12, 2013

  • archisman r.

    Covered essentials very well and links to further studies.

    June 11, 2013

  • Guillermo I.

    Sorry guys, can't make it :(

    June 11, 2013

  • Carter S.

    can't make it sadly

    June 11, 2013

  • Geoffrey K.

    I have a conflict that evening, but I look forward to the slides.

    June 10, 2013

  • Joe G.

    Conflict with cloud expo event

    June 10, 2013

  • jcv

    This one sounded really good, but unfortunately something else came up. Hope some slides from it end up online.

    June 9, 2013

  • Raymond P.

    As always, I look forward to hearing you speak.

    1 · June 5, 2013

  • Markus S.

    Wish I could go! I will be on a plane then. Will slides possibly be posted afterwards?

    1 · June 5, 2013

    • Pierre de L.

      Yes, I will definitely make the slides available afterwards via Slideshare, and there will also be a video available, eventually. :-)

      1 · June 5, 2013

    • Mikhail

      Thanks Raymond, it would be great to get the video and slides as I unfortunately cannot make it on Tuesday

      June 5, 2013

  • prasad r.

    Tuesdays are hard for me. I'll wait for the video to be posted. Always wanted to learn about MOP and CLOS.

    May 29, 2013

  • Guillermo I.

    I would not miss this; it will be great to learn about metaprogramming and all of the above using common lisp.

    May 29, 2013

  • Jim P.

    Sadly cannot make it. Will be at ScalaDays.

    May 29, 2013

  • Ivan W.

    Look forward to the talk.

    May 29, 2013

  • Guillermo I.

    I would not miss this; it will be great to learn about metaprogramming and all of the above using common lisp.

    May 26, 2013

Our Sponsors

  • NYI.net

    Colocation and hosting in downtown Manhattan

People in this
Meetup are also in:

Imagine having a community behind you

Get started Learn more
Henry

I decided to start Reno Motorcycle Riders Group because I wanted to be part of a group of people who enjoyed my passion... I was excited and nervous. Our group has grown by leaps and bounds. I never thought it would be this big.

Henry, started Reno Motorcycle Riders

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy