Angel \”Java\” Lopez on Blog

May 15, 2012

Metaprogramming: Links, news and resources (1)

Filed under: Java, JVM, Links, Metaprogramming, Programming Languages, Ruby, Smalltalk — ajlopez @ 1:33 pm

As a programming language fan and writer of many interpreters, I’m interested in metaprogramming. Some links I found useful:

Metaprogramming is the writing of computer programs that write or manipulate other programs (or themselves) as their data, or that do part of the work at compile time that would otherwise be done at runtime. In some cases, this allows programmers to minimize the number of lines of code to express a solution (hence reducing development time), or it gives programs greater flexibility to efficiently handle new situations without recompilation.

magarciaEPFL / MethodHandleUtils
JVM: Composing MethodHandles at runtime like AST nodes
Runtime metaprogramming via java.lang.invoke.MethodHandle

Ruby Metaprogramming: Declaratively Adding Methods to a Class

dlitvakb / MetaBuilder
A Ruby MetaProgramming Excercise

Adding Properties to Ruby Metaprogramatically

Ruby: More About Methods

Calling Methods Dynamically

Ruby dynamic method calling

celluloid / celluloid
Actor-based concurrent object framework for Ruby

MetaProgramming – Extending Ruby for Fun and Profit

Three implicit contexts in Ruby
Yehuda Katz wrote an article about self and metaclass. In the article he said that Person.instance_eval assigns Person’s metaclass to self for a class Person. But this is obviously wrong.
Ruby always has three implicit contexts: self), so called `klass’ and the constant definition point.

Metaprogramming in Ruby: It’s All About the Self

class << self idiom in Ruby


Default Ruby accessor method?
method_missing; it gets called whenever an undefined method is used

A Logic Meta-Programming Approach
to Support the Co-Evolution of
Object-Oriented Design and Implementation

Meta-level Programming with CodA

C#5 and Meta-Programming

Metaprogramming in .NET

Whole Platform
the Whole Platform provides an Eclipse-based Language Workbench for developing new languages, manipulating them using domain notations and transforming them using a generative model driven approach.

Code Generation on the JVM: Writing Code that Writes Code

Rascal – Meta Programming Language
Rascal is a domain specific language for source code analysis and manipulation a.k.a. meta-programming.

Write A Template Compiler For Erlang
Implementing the Django Template Language in Erlang

Groovy: Best Practices Developed From Distributed Polyglot Programming

The Magnificent Seven
creating a Lisp variant in seven forms

The calculator language tutorial

The art of metaprogramming, Part 1: Introduction to metaprogramming
One of the most under-used programming techniques is writing programs that generate programs or program parts. Learn why metaprogramming is necessary and look at some of the components of metaprogramming (textual macro languages, specialized code generators). See how to build a code generator and get a closer look at language-sensitive macro programming in Scheme.

Through the Looking Glass Darkly
The classic approach to reflection in object-oriented programming languages originates with Smalltalk, and is used in most class based languages that support reflection: define a reflective API on Objec
nother approach is used in many scripting languages. The language constructs themselves introduce code on the fly, modifying the program as they are executed.
The third approach is that of mirrors, and originates in Self. Mirrors have been used in class based systems such as Strongtalk, and even in the Java world. JDI, the Java Debugger Interface, is a mirror based reflective API. Here, the reflective operations are separated into distinct objects called mirrors.

Mirrors: Design Principles for Meta-level Facilities of Object-Oriented Programming Languages

Metaprogramming: Ruby vs. Javascript

Metaprogramming in Ruby

A Basic YAML Config Module For Ruby

Categories, the homemade object system


Why? Language Archaeology … and Metaprogramming

Metaclasses Demystified
The word “metaclass” often strikes fear into the hearts of Python programmers. This article explores metaclasses in an approachable way, in order to take the mystery out of metaclasses, and enable you to leverage metaprogramming techniques to solve real problems.

Dupping Our Way Out of Instance Eval

In this RubyFringe talk, Reginald Braithwaite shows how to write Ruby that reads, writes, and rewrites Ruby. The demos include extending the Ruby language with conditional expressions, new forms of evaluation such as call-by-name and call-by-need, and more.

Smalltalk magritte-metamodel
Magritte is a fully dynamic meta-description framework that helps to solve those problems, while keeping the full power to the programmer in all aspects.

My Links

More links about DLSs, programming languages, and metaprogramming are coming.

Keep tuned!

Angel “Java” Lopez

Blog at