archives

"dynamic" generative programming?

I'm trying to write a denotational semantics and I'm having a problem. I seem to only be able to express what I want by writing code that generates code, rather than just writing code. By "code" I mean my lambda-calculus-like definitional language. (Actually I plan to use Haskell for this and thus get a semantics and a reference implementation "for free" but I digress.)

Anyway, I could give specifics, and perhaps the question doesn't make sense without specifics (if so, I'll be glad to post what I have) but I wonder if anyone has some high-level comments on this type of problem.

It seems like a general problem in programming not specific to denotational semantics, actually. It seems like the idea of generative programming accomodates the need to generate code at compile-time, but I'm not as familiar with efforts to accomodate run-time ("dynamic") code generation. LISP macros? For one thing this style of programming requires the language to have an "eval" function or similar, or requires the program to ship with a compiler.

Before I saw C++ templates, I generally considered generating code to be a sign of weakness of the programmer and/or the language, because my primary example was C with the C preprocessor. Now I've changed my mind, and I wonder whether we try to put too much into languages whereas we could somehow have simpler languages with more powerful code generation facilities.

Oh well, I'm kind of rambling at this point, so I'll stop since I've probably provided plenty of fodder for feedback.

Functions as Classes: Which languages?

I was thinking of possibly making all functions in the Heron programming language into classes with a single public field named "result". I was wondering what other languages do similar things to this, and what the advantages / disadvantages might be of such as approach.

I have posted an example of Heron code which would model this apporach at http://www.artima.com/weblogs/viewpost.jsp?thread=116558

Thanks in advance!

LispNYC's proposed Summer of Code projects

Interesting list.

Personally, I am most interested in seeing results come out of the PltStepper, PltDb and ErLisp projects.