Subject: Re: define-syntax: considered harmful (was PLT DRScheme)
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 1998/06/11
Newsgroups: comp.lang.scheme
Message-ID: <6lnjkh$unfi@fido.engr.sgi.com>

Jason M. Petry <Petry.10@osu.edu> wrote:
+---------------
|     Ray> Is it true, or false, that R4RS and R5RS both require a
|     Ray> redefinition of a procedure to leave other procedures defined
|     Ray> in terms of it unaffected?  -- i.e. if the lambda's defining
| 
| In short, no. 
+---------------

Well, actually, I think the real answer is "maybe".  ;-}  ;-}

See section 6 of R5RS, where it says:

	A program may use a top-level definition to bind any variable.
	It may subsequently alter any such binding by an assignment
	(see 4.1.6). These operations do not modify the behavior of
	Scheme's built-in procedures.

Notice that it does *NOT* distinguish between "built-in procedures" and
"built-in LIBRARY procedures" in this requirement, so if some library
procedures happen to be implemented, say, in a Scheme initialization file
that gets autoloaded at startup, they also must be protected from such
user behavior.

It goes on to say:

	Altering any top-level binding that has not been introduced
	by a definition has an unspecified effect on the behavior of
	the built-in procedures.

I read this as saying that while:

	(define + ...something-else...)
or:
	
	(define + +)
	...
	(set! + ...something-else...)

must not affect any built-in procedures ("library" or not) that use "+",
that without a preceding "define" then just:

	(set! + ...something-else...)

would have "an unspecified effect on the behavior"...


-Rob

-----
Rob Warnock, 7L-551		rpw3@sgi.com   http://reality.sgi.com/rpw3/
Silicon Graphics, Inc.		Phone: 650-933-1673
2011 N. Shoreline Blvd.		FAX: 650-933-4392
Mountain View, CA  94043	PP-ASEL-IA