[Openmcl-devel] Side effects when redefining dispatching reader macro?
gb at clozure.com
Thu Nov 12 20:39:05 PST 2015
For whatever it is worth, the more I think of it, the more it seems to
me that the behavior of MAKE-DISPATCH-MACRO-CHARACTER
in CCL is correct.
The best reason that I have been able to think of for believing
otherwise is that making previous definitions of characters associated
with the dispatching macro character signal errors may be unintended.
calling DELETE-FILE may be unintended, but it is relatively
clear what the effects of doing so should be. If you don't want to
change the definition of all characters associated with (e.g.) #\#
in a given readtable, don't call MAKE-DISPATCH-MACRO-CHARACTER. If one
does want that behavior (for whatever reason) and
MAKE-DISPATCH-MACRO-CHARACTER doesn't do it for you, is it necessary to
call SET-DISPATCH-MACRO-CHARACTER to some function
that signals an error for every possible character?
If the definition of MAKE-DISPATCH-MACRO-CHARACTER said that it only
does what that definition says it does if you intended for that
to happen, fine. It doesn't qualify the described behavior at all.
Neither does the description of DELETE-FILE (which is obviously more
implementation- and filesystem dependent but otherwise seems analogous.
On 11/12/2015 03:27 PM, Gary Byers wrote:
> On 11/12/2015 11:37 AM, Ron Garret wrote:
>> (MAKE-DISPATCH-MACRO-CHARACTER #\# NIL*readtable*)
> CLHS says (of MAKE-DISPATCH-MACRO-CHARACTER) that,
> "Initially, every /character/
> in the dispatch table associated with the /char/ has an associated
> function that signals an error of /type/
> In the body of your message, you seemed to expect #' to have retained
> its original definition.
> If the term "... makes char be a dispatching-macro-character ..." is
> read as "does nothing if the character is already defined as a
> dispatching-macro, else ...",
> your expectation is reasonable. I am probably more accustomed to the
> behavior that that you said that you get in 1.10, but both
> expectations seem reasonable.
> Portable code could avoid the issue by calling
> GET-DISPATCH-MACRO-CHARACTER and only calling
> MAKE-DISPATCH-MACRO-CHARACTER if the character is not already defined
> as a dispatching macro. I don't know what the library that the
> original poster mentioned does. or what version of that library they
> are using.
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Openmcl-devel