[Contents]   [Back]   [Prev]   [Up]   [Next]   [Forward]  


Notes

Language changes

This section enumerates the changes that have been made to Scheme since the "Revised revised report" [RRRS] was published.

Keywords as variable names

Some implementations allow arbitrary syntactic keywords to be used as variable names, instead of reserving them, as this report would have it. But this creates ambiguities in the interpretation of expressions: for example, in the following, it's not clear whether the expression (if 1 2 3) should be treated as a procedure call or as a conditional.


(define if list)
(if 1 2 3)                             ==>  2 or (1 2 3)

These ambiguities are usually resolved in some consistent way within any given implementation, but no particular treatment stands out as being clearly superior to any other, so these situations were excluded for the purposes of this report.

Macros

Scheme does not have any standard facility for defining new kinds of expressions.

The ability to alter the syntax of the language creates numerous problems. All current implementations of Scheme have macro facilities that solve those problems to one degree or another, but the solutions are quite different and it isn't clear at this time which solution is best, or indeed whether any of the solutions are truly adequate. Rather than standardize, we are encouraging implementations to continue to experiment with different solutions.

The main problems with traditional macros are: They must be defined to the system before any code using them is loaded; this is a common source of obscure bugs. They are usually global; macros can be made to follow lexical scope rules , but many people find the resulting scope rules confusing. Unless they are written very carefully, macros are vulnerable to inadvertant capture of free variables; to get around this, for example, macros may have to generate code in which procedure values appear as quoted constants. There is a similar problem with syntactic keywords if the keywords of special forms are not reserved. If keywords are reserved, then either macros introduce new reserved words, invalidating old code, or else special forms defined by the programmer do not have the same status as special forms defined by the system.


[Contents]   [Back]   [Prev]   [Up]   [Next]   [Forward]