Sat Mar 13 15:23:12 CET 2010
Functions vs Macros
So what is the great benefit of functional programming?
Fan-out of functions.
I.e. functions are values. A single function can be used multiple
Why are macros and functions different? Macros get duplicated
(instantiated) and loose their unique identity. I.e. they are
functions used in a previous stage and are completely gone in the end
( This smells like objects: objects are functions connected to state
such that the objects are the things with unique identities. )
So the deal is that you don't really want to ever expand a macro if
you want to analyse its meaning.
I believe this is the basic idea behind typed, staged programming:
macros (code processing functions) keep their identity, i.e. they have
a real meaning on the meta-level (are separately typable).
I need to go back and have a look at OBJ. It also deals with
instantiation of templates.