Thesis on metaprogramming in D

Steve Horne stephenwantshornenospam100 at aol.com
Mon Nov 27 22:55:03 PST 2006


On Mon, 27 Nov 2006 15:23:33 -0300, Leandro Lucarella
<llucarella at integratech.com.ar> wrote:

>The center of my thesis would be adding meta-classes[1] to D, and maybe 
>some other meta-programming features D could lack of (maybe some kind of 
>access to the AST like XLR[2]).

I can't really offer any useful support, but if I understand what you
are saying, I can offer encouragement.

My view of the ideal handling of metaprogramming is that it should
have access to all the features that are available at runtime. The
only languages that I know that genuinely achieve that are the
Lisp-alikes such as Scheme.

My ideal is being able to define 'quoted' blocks that are parsed and
translated to ASTs, with those ASTs being processed by other code to
derive new ASTs which are then submitted for the final back-end
optimisation and code generation.

Which is not anti-templates as such. I like templates. It just means
that, in principle, you could define an alternative template mechanism
as a library.

The nearest you get to this at the moment (outside Lisp-alikes), at
least that I know of, are languages like Python where you can access
the AST, including the AST of generated code, at run-time.

Thanks for the XLR link, by the way - very interesting, and possibly
capable of exactly what I described above, though I've not read it
properly yet.

-- 
Remove 'wants' and 'nospam' from e-mail.



More information about the Digitalmars-d mailing list