Alex Rivera | Logout

How Does Static Typing Limit Macros?

Asked 2009-10-17T19:46:38.543
12

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.

Edit
Report

2 Answers

3

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

answered 2009-10-17T21:05:01.543
0

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.

answered 2009-10-17T20:59:18.067

Your Answer