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:


http://en.wikipedia.org/wiki/Metaprogramming

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

https://github.com/magarciaEPFL/MethodHandleUtils

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

http://lampwww.epfl.ch/~magarcia/ScalaCompilerCornerReloaded/2012Q2/RuntimeMP.pdf

Ruby Metaprogramming: Declaratively Adding Methods to a Class

http://www.vitarara.org/cms/ruby_metaprogamming_declaratively_adding_methods_to_a_class

dlitvakb / MetaBuilder

https://github.com/dlitvakb/MetaBuilder

A Ruby MetaProgramming Excercise

Adding Properties to Ruby Metaprogramatically

http://www.infoq.com/articles/properties-metaprogramming

Ruby: More About Methods

http://ruby-doc.org/docs/ProgrammingRuby/html/tut_methods.html

Calling Methods Dynamically

http://www.linuxtopia.org/online_books/programming_books/ruby_tutorial/Reflection_ObjectSpace_and_Distributed__Ruby_Calling_Methods_Dynamically.html

Ruby dynamic method calling

http://khelll.com/blog/ruby/ruby-dynamic-method-calling/

celluloid / celluloid
Actor-based concurrent object framework for Ruby

MetaProgramming – Extending Ruby for Fun and Profit

http://www.infoq.com/presentations/metaprogramming-ruby

Three implicit contexts in Ruby

http://yugui.jp/articles/846

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

http://yehudakatz.com/2009/11/15/metaprogramming-in-ruby-its-all-about-the-self/

class << self idiom in Ruby

http://stackoverflow.com/questions/2505067/class-self-idiom-in-ruby

ClassInstanceVariable

http://martinfowler.com/bliki/ClassInstanceVariable.html

Default Ruby accessor method?

http://stackoverflow.com/questions/636277/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

http://scg.unibe.ch/archive/phd/Wuyts-phd.pdf

Meta-level Programming with CodA

http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.108.6885

C#5 and Meta-Programming

http://codebetter.com/patricksmacchia/2010/05/31/c-5-and-meta-programming/

Metaprogramming in .NET

http://www.manning.com/hazzard/

Whole Platform

http://whole.sourceforge.net/

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

http://www.infoq.com/presentations/Code-Generation-on-the-JVM

Rascal – Meta Programming Language

http://www.rascal-mpl.org/

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

Write A Template Compiler For Erlang

http://evanmiller.org/write-a-template-compiler-for-erlang.html

Implementing the Django Template Language in Erlang

Groovy: Best Practices Developed From Distributed Polyglot Programming

http://www.infoq.com/presentations/Groovy-Best-Practices

The Magnificent Seven

http://fogus.me/static/preso/magnificent7/#slide1

creating a Lisp variant in seven forms

The calculator language tutorial

http://www.jetbrains.com/mps/docs/tutorial.html

The art of metaprogramming, Part 1: Introduction to metaprogramming

http://www.ibm.com/developerworks/linux/library/l-metaprog1/index.html

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

http://gbracha.blogspot.com.ar/2010/03/through-looking-glass-darkly.html

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

http://www.bracha.org/mirrors.pdf

Metaprogramming: Ruby vs. Javascript

http://fingernailsinoatmeal.com/post/292301859/metaprogramming-ruby-vs-javascript

Metaprogramming in Ruby

http://ruby-metaprogramming.rubylearning.com/

A Basic YAML Config Module For Ruby

http://lostechies.com/derickbailey/2009/10/05/a-basic-yaml-config-module-for-ruby/

Categories, the homemade object system

http://lambda-the-ultimate.org/node/3569

Categories

http://mikelevins.livejournal.com/3678.html

Why? Language Archaeology … and Metaprogramming

http://www.artima.com/weblogs/viewpost.jsp?thread=260578

Metaclasses Demystified

http://cleverdevil.org/computing/78/

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

http://banisterfiend.wordpress.com/2008/12/19/dupping-our-way-out-of-instance-eval/

Ruby.rewrite(Ruby)

http://www.infoq.com/presentations/braithwaite-rewrite-ruby

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

http://code.google.com/p/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

http://delicious.com/ajlopez/metaprogramming

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

Keep tuned!

Angel “Java” Lopez

http://www.ajlopez.com


http://twitter.com/ajlopez

Theme: Shocking Blue Green. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 37 other followers