[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: global definitions
Though I spent time in Indiana, I must join with JINX and Andy in
protest against the very idea of global definitions. If we must
have global definitions, I propose that the syntax be
(SETF (SYMBOL-FUNCTION 'FOO) ...)
so as to avoid gratuitous differences between Scheme and Common Lisp.
As prelude to more serious comments, let me summarize the status quo:
INCREMENTAL DEFINE: Not in the report, but appears in S&ICP. Supported
only by MIT Scheme, though T has something similar.
INTERNAL DEFINE: Optional in the report, pervasive in S&ICP. Alternative
syntax for LETREC. Supported by MIT Scheme, PC Scheme, and MacScheme.
TOP-LEVEL DEFINE: Essential in the report. It is up to the programming
environment whether top-level definitions are implemented as global
bindings, incremental bindings, or assignments; it makes very little
semantic difference. Supported by everyone.
I don't want to give in to Guy's suggestion that internal definitions be
dropped entirely because it would return us to the days when we couldn't
read each other's code. The implementations that support internal
definitions for compatibility with S&ICP would go on supporting them,
while people using Chez Scheme and Scheme-84 would write syntactically
identical code that does something completely different. If everyone
could agree not to use DEFINE except at top level I might agree with Guy,
but that just isn't going to happen. (For instance, the idea of dropping
internal DEFINE wouldn't even have come up if the people at Indiana
weren't so insistent on using the word DEFINE at places other than top
level.)
Though I once programmed in the Indiana style, I have found it easy to
switch to the new idiom:
(define foo)
(define bar)
(let (<local state>)
(set! foo ...)
(set! bar ...))
I am partly in the dark because I have not yet received Chris Haynes's
message, but I suspect that folks at Indiana have not really given the
above idiom a chance because the one message I have received says only
that both "define!" and "global-define" were tried.
In short, I'm not a fan of the internal definition syntax, but I vote in
favor of keeping it in the report so as to prevent the syntax from being
used with two incompatible semantics.
Peace, Will