[<<][meta][>>][..]
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
times.


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
stage.

( 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[1].  It also deals with
instantiation of templates.

[1] http://citeseerx.ist.psu.edu/viewdoc/download;jsessionid=3538530B13621FE83E2532A38E7A8B47?doi=10.1.1.36.1030&rep=rep1&type=pdf




[Reply][About]
[<<][meta][>>][..]