Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker.mit.edu!ai-lab!zurich.ai.mit.edu!markf From: markf@zurich.ai.mit.edu (Mark Friedman) Newsgroups: comp.lang.scheme Subject: Re: Why macros impair readability (long) Message-ID: Date: 6 Mar 91 20:53:57 GMT References: <9103041928.aa21342@mc.lcs.mit.edu> Sender: news@ai.mit.edu Reply-To: markf@zurich.ai.mit.edu Organization: M.I.T. Artificial Intelligence Lab. Lines: 51 In-reply-to: lyn@altdorf.ai.mit.EDU's message of 5 Mar 91 00:27:58 GMT First let me say that I applaud Franklyn's attempt to unravel and explicate the issues involved Scheme code readability. I also marvel at and envy the clarity of his writing. OK, now that I have buttered him up ... I think that his arguments are sound but his premise is faulty. In particular, after presenting many reasonable interpretations of the term "readable" he chooses the least useful. He uses the term to mean "easy to reason about locally". The problem is that for large (and well abstracted) programs local reasoning gets you very little information. For example, consider the following procedure: (define (foo bar) (mumble ((grumble bar) baz fumble) zaz) grok (((bar)))) Would it really help to know that grumble is a macro? Unless you know what grumble really does (or at least what it is supposed to do) the issue of whether it is a macro or a procedure is fairly moot. And in the process of discovering what grumble actually does you will find out whether it is macro or a procedure. Now admittedly, macros are, on the whole, harder to figure out than procedures, but that is not a issue of local readability. A sufficiently complex macro (or procedure) must be well documented. Higher level macro decription languages like extend-sytax help a lot here also. Your specific arguments against macros are well taken, but they seem to imply a certain naive view (not that I think that Franklyn is naive in any way :-) of the Scheme evaluation model. Scheme is not the lambda calculus and it's not referentially transparent. Macros do add extra comlexity, but I don't feel that they qualitatively change the rules of the game. More importantly, they give us another powerful abstraction mechanism. -Mark -- Mark Friedman MIT Artificial Intelligence Lab 545 Technology Sq. Cambridge, Ma. 02139 markf@zurich.ai.mit.edu