On Thu, Apr 1, 2010 at 5:44 PM, Taylor R Campbell <campb...@mumble.net> wrote: > > When you're writing the macro you need to decide what its evaluation > rules are. You can defer parts of that decision to some other > operator by passing subforms of the input to an invocation of the > other operator. Introducing self-evaluating symbols doesn't make the > decision any easier or more convenient, however. It only makes > certain uses of macros independent of that decision.
Imagine a version of Scheme where no object was self-evaluating. Numbers, for instance, would evaluate to a procedure that selected the nth element of something. Strings would evaluate to formatting templates. etc. Every literal object would require quoting. There is the trivial annoyance that you have to use a lot more quote marks, but there is a less trivial annoyance. You wouldn't be able to easily determine if the quoted form '2 was quoted because it was going to be used as a literal number for arithmetic, or quoted because it was expected to be pasted into some list structure that was eventually destined to become code (so that the end purpose will be a call to caddr). You could tell by context. You could tell by looking at other quoted things in close proximity, but you can't tell by simple inspection. Fortunately, because numbers are self evaluating, you can be pretty sure that if you see one, then it really means a *number* and the purpose is arithmetic no matter what context. The same is true with symbolic literals. Sure, you can examine the context and figure out that the reason the symbol is quoted is because you want to build a Scheme program with that symbol as an identifier in the program, (rather than using the symbol as something to test EQ? against), but a self-evaluating keyword *can't* be an identifier and you can tell from inspection. It's only useful as a symbolic literal. (Conversely, if you follow convention, non-keyword symbols are supposed to be identifiers). > I still don't buy it, and I'm afraid I got lost in your example -- > there were about a dozen keywords involved, and it was not clear to me > which ones needed to be self-evaluating objects and how that had > anything to do with how much quoting and unquoting you needed to write > in your macro. That's the point. *All* the keywords are self-evaluating and therefore the amount of quoting and unquoting is irrelevant. In any case, if you don't want to use them, you don't have to (they are off by default). If it makes you happier to write ':foo instead of :foo, go ahead. -- ~jrm _______________________________________________ MIT-Scheme-devel mailing list MIT-Scheme-devel@gnu.org http://lists.gnu.org/mailman/listinfo/mit-scheme-devel