views:

108

answers:

3

I was reading Paul Graham's "The Hundred-Year Language" article.

http://www.paulgraham.com/hundred.html

In there he makes a claim that static typing "preclude[s] true macros".

For example, types seem to be an inexhaustible source of research papers, despite the fact that static typing seems to preclude true macros-- without which, in my opinion, no language is worth using.

How is this true? Where are the papers? I tried searching on Google without success.

+4  A: 

Static typing doesn't preclude macros. For example, the static-typed Boo language has macros. So does Nemerle.

However, it depends on what Graham means by "true" macros. Maybe Boo and Nemerle macros are "false" by his standards.

itowlson
A: 

Static typing, in which the system does not infer types, prevents truly general-purpose macros as the output of macros must remain type-safe in a very restrictive sense.

phoebus
+1  A: 

It isn't really true that static typing precludes macros, but it generally does mean that the macro system needs to be more complicated than the unhygienic text-substitution macros familiar to many. I'm not exactly sure what Graham is trying to get at here, or what he means by "true" macros.

See this paper for one take on hygienic macros in a statically typed context.

(Incidentally, I also don't agree that no language is worth using if it doesn't have macros. I think that first-class functions coupled with some of the more sophisticated modern type systems can elegantly solve most of the problems at which macros have traditionally been aimed.)

Doug McClean