
The authors introduce this new approach to programming language design, describe its evolution and design principles, and present a formal specification of a metaobject protocol for CLOS. The CLOS metaobject protocol is an elegant, high-performance extension to the CommonLisp Object System. The authors, who developed the metaobject protocol and who were among the group that developed CLOS, introduce this new approach to programming language design, describe its evolution and design principles, and present a formal specification of a metaobject protocol for CLOS. Kiczales, des Rivières, and Bobrow show that the "art of metaobject protocol design" lies in creating a synthetic combination of object-oriented and reflective techniques that can be applied under existing software engineering considerations to yield a new approach to programming language design that meets a broad set of design criteria. One of the major benefits of including the metaobject protocol in programming languages is that it allows users to adjust the language to better suit their needs. Metaobject protocols also disprove the adage that adding more flexibility to a programming language reduces its performance. In presenting the principles of metaobject protocols, the authors work with actual code for a simplified implementation of CLOS and its metaobject protocol, providing an opportunity for the reader to gain hands-on experience with the design process.
For OO, every serious software engineer should read The Art of the Metaobject Protocol sometime in their lives.
For examples, McCarthy's original purpose was to demonstrate the effectiveness of a symbolic differentiation process he had dreamt up, so he devised the syntax and meta-circular evaluator of lisp to make it maximally obvious from the program text that the differentiation system was mathematically correct, while keeping it maximally obvious from the program model definition that it was computationally concrete. In response to new trends in the programming field, Lispers write mind-bending books like "Let over Lambda", "The Art of the Metaobject Protocol", or "Software Design for Flexibility" to show that, when your syntax and model is right, you can radically change how you solve problems not by rewriting your spec or switching languages but by just adding more lisp to the lisp you already have, which has the same simplicity as radically increasing the sculptures a child can make by just adding more lego to the lego they already have.
Lisps, on the other hand, tend to add features as just more convenient versions of things they can already do: Macrology for self-adapting code? Just lisp functions on lisp data structures corresponding to lisp functions. Actors for a concurrent execution model? Lisp functions as lisp data parameterized by higher-order lisp functions. Composable continuations for error handling? A lisp function exploring a lisp data structure of lisp data structures of lisp functions. It's turtles all the way down. Paul Graham points out that you can understand the social hype the presence or absence of a feature like operator overloading as a consequence of friction-ful syntaxes, while lispers care much less because replacing a function you don't prefer with one you do for your use case is straightforward in a friction-free syntax. When he decided to build a reddit clone for tech entrepreneurs he didn't need an outside data system just to get started, he only had to spin up a pool of threads for sessions to directly modify s-expression literals in memory, which he could save or modify by printing straight to disk and load by just reading the lisp syntax back into memory like all lisp code is, with no execution intermediary like languages such as the Pythons tend to have complicating things enough to make comparatively big services like a whole database for a private gossip forum worth the effort. The syntax doesn't make lisp first-order beautiful, it makes lisp the hacker's local maximum, which is second-order beautiful, and honestly isn't much harder to get into the habit of reading once you know it's worth it.
minute 54 https://www.youtube.com/watch?v=oKg1hTOQXoY&t=634s
on "The Art of the Metaobject Protocol"
It should be a mandatory read for anyone looking to design a programming language with object concepts.
The Art of the Metaobject Protocol
Programming is (should be) fun. ( https://www.youtube.com/watch?v=2MYzvQ1v8Ww&ab_channel=ACMSIGPLAN )
I've been programming for 52 years. I still program, basically because it IS fun. That said, it is only fun if you have an VERY high tolerance for frustration. Programs, like art, are only finished when you stop working on them. Literate programs have raised the bar for Pulizer-worthy programs.
Knuth, in Salon interview (https://www.salon.com/1999/09/16/knuth/), said
...Besides demonstrating the techniques of clear, efficient coding, Knuth has sought to bring a deeper sense of aesthetics to the discipline. "You try to consider that the program is an essay, a work of literature," he says. "I'm hoping someday that the Pulitzer Prize committee will agree." Prizes would be handed out for "best-written program," he says, only half-joking. ...
There are a few programming books I've re-read a few times, just for the joy of it, which is the essence of quality literature. These are:
Lisp In Small Pieces by Christian Queinnec. I believe this is the best programming book ever written.
The Art of the Metaobject Protocol by Gregor Kiczales and Jim des Rivieres. This is mind-expanding.
Let Over Lambda by Doug Hoyte. This is the very foundation of programming.
Every time I re-read these books I find more understanding and great intellectual pleasure. If there ever was a prize for the literature in the field of programming, these are my candidates.
If you have a potential candidate, please add it in the comments.