## Ian Bicking: The challenge of metaprogramming

So I think it's really important that we approach metaprogramming with caution. I think Guido has been right to resist macros. Not because they are necessarily wrong, but because we haven't yet figured out how to do them right. And maybe we never will, maybe source code simply isn't the right level for abstractions. I think it's good that Python doesn't do tail-call elimination; it seems like a nice feature, but in subtle ways it makes the language harder. And I think continuations could lead to bad things. There are wrong paths on the road to higher-level programming. (Though in some ways I also feel the opposite: tell us not to shoot ourselves in the foot, and expect us to listen, don't assume we'll abuse every feature that exists; there's always a tension in these design choices.)

This deserves more attention than I can give it right now, but I am sure others here will want to comment.

## Python, metaprogramming, and macros

A nice blogpost from Ian Bicking.

## Haskell Communities and Activities Report, Seventh Edition, November 2004

The November 2004 edition of the biannual Haskell Communities and Activities Report has been published. Lots of new stuff in the last six months, and some old stuff updated as well. The HC&AR has been steadily growing over the last three years, showing that FP is gaining users both professional and private.

Several of the HC&AR items are interesting enough to have their own LtU stories, which may appear shortly.

## Fresh O'Caml

Fresh O'Caml aims to provide the features of the Objective Caml language (with the exception of native-code compilation) together with:

• a type of names for representing object-level bindable names;
• abstraction expressions for representing object-level binding;
• pattern-matching for deconstructing abstraction values;

Fresh O'Caml is Mark Shinwell's sucessor to Andrew Pitts's last summer's blockbuster FreshML. It's experimental, but Tom tells me it's very cool, and I trust him. This work comes out of... no, not INRIA, enclave of O'Caml High Acolytes, but rather the University of Cambridge Computer Laboratory Theory and Semantics Group. Here are the obligatory tasty paper morsels:

More papers than you can shake a stick at on Fresh O'Caml's dad, FreshML, are also available.
Finally, there's a mailing list you can join for information, updates, and discussion about FreshML and Fresh O'Caml

## Pythologic - Prolog syntax in Python

The "recipe" for Pythologic is given and discussed here:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/303057

The discussion is interesting in itself, as it identifies the "wildly unpythonic" and "abusive" "overhaul of the function semantics" involved. One thing I've always liked about Python is the extent to which it supports this kind of metaprogramming. You can, if the mood takes you, quite seriously deform the language's conventional semantics. That isn't necessarily a good thing; but it can be fun sometimes.

David Mertz has written an article on embedding declarative mini-languages in Python, which demonstrates some other techniques.

## A Deeper Look At Metafunctions

In this Artima article, David Abrahams and Aleksey Gurtovoy take a deeper look at metafunctions, and introduce the Boost metaprogramming library.

The article is an extract from the authors' forthcoming C++ Template Metaprogramming.

The authors' example application of C++ metafunctions is compile-time dimensional analysis. Higher order metafunctions, partial metafunction application and lazy evaluation are also discussed.

Wouldn't an Amazon sponsored link to the book be a good idea here?

## Attribute-Oriented Programming with Java 1.5

An interesting look at the addition of annotations to the next generation Java. Not sure what the main purpose of this metadata is, but the author discusses it in terms of debugging and instrumentation.

Annotation definitions look a lot like interface definitions, but the keyword @interface is used instead of interface and only methods are supported (though they act more like fields).

   public @interface Status {
String value();
}

I can now define my method as follows:

   @Status("Connecting to database")
public void connectToDB (String url) {
...
}

## Multi-stage Programming in MetaOCaml

Interesting tutorial.

I don't recall seeing the link to this set of slides here before.

## Code Generation Netwrok

A nice site dedicated to all things related to code generation.

This site includes a detailed list of code generators for various languages and platforms.