Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wilson From: wilson@cs.utexas.edu (Paul Wilson) Newsgroups: comp.lang.scheme Subject: Macros Summary: Macros *must* be standardized Keywords: macro, extend-syntax, lexical scope, standards Message-ID: <1490@yoakum.cs.utexas.edu> Date: 29 May 91 01:02:34 GMT Organization: U Texas Dept of Computer Sciences, Austin TX Lines: 50 I respectfully differ with the "open letter" about Scheme. In particular, macros *must* be standardized if Scheme is to survive. Of all the barriers to using Scheme, this one's probably the easiest to fix. I do not think it is terribly important that Scheme be extremely small; it is more important that it is Done Right. Macros can be done right (progress has been made lately), and should be part of the language. I have made attempts to collect serious, portable Scheme programs, and there are almost none. The main reason, as near as I can tell, is that everyone uses macros, but they are not standardized. Therefore Scheme is a toy language, and all real implementations define some form of macros. I suggest that the Scheme committee standardize macros as soon as is practical. In particular, if it is possible to settle upon a minimal set of features for a macro facility (to be enhanced later), PLEASE DO IT. If this entails some undefined behavior, which can be avoided with proper coding style, that seems acceptable. (Later versions of the standard could then define "correct" behavior for those cases.) There are simply too many places where people need macros, any macros, and they don't care if they're lexically scoped or pretty or whatnot. It would just be nice to have some syntax for macros that can be used now, and which will not invalidate programs in the future (if used carefully -- e.g., avoiding scoping screws). I would also like to point out that a lexically-scoped macro facility needn't be all that complicated. A decent Scheme compiler is a nontrivial piece of work anyway, and the compile-time environments of the compiler (used for computing lexical addresses) can be straightforwardly extended to keep track of syntactic bindings. (And labels, for that matter.) Syntactic environments are essentially reified compile-time environments, and aren't all that hard to implement. The framework is already there. The Scheme committee should not avoid specifying lexically-scoped macros on the basis of compiler complexity. The added functionality is well worth it, and they don't make it hard to generate good code. With respect to other features (e.g., multiple value returns), it may well be that they should be left out of the core language, and made optional. But macros are so important that their basic functionality MUST be part of the standard language. (Fancy features such as complex pattern matching might be made optional.) -- Paul