Stephen Compall s11 at member.fsf.org
Thu Oct 2 23:08:04 UTC 2008

"Tobias C. Rittweiler" <tcr-0l3vezLb4dgb1SvskN2V4Q at public.gmane.org> writes:
>   Ariel Badichi proposed coalescing a generator's fourth return value
>   (indicating if the returned character is a dispatch macro character) with its
>   first return value (indicating if the generator is exhausted.)
>   There is technically no reason that speaks against doing so; in fact, a
>   generator would return one value less this way--which may lead to positive
>   performance characteristics on register-anemic processor architectures.
>   Stephen Compall and the author opposed such a change mostly for idiomatic
>   reasons, as both `with-hash-table-iterator' and `with-package-iterator', the
>   generator-establishing macros specified by the ANSI standard, return a purely
>   boolean exhaustion flag as first value. In particular, `with-package-iterator'
>   does _not_ coalesce the accessibility type (third return value) with the
>   exhaustion flag (first return value.)

I will briefly summarize my full position on the subissue of whether the
fourth value's type should be boolean rather than (member :macro-char

There is no antonym in common use for "dispatching" with respect to
macro characters among Lisp programmers.  As such, the only way to say
that a macro character is not dispatching while ensuring that your
meaning is clear to others who are working with readtables is to say
"not dispatching".  So our partition of macro character types is
"dispatching" and "not dispatching", which has a linguistically natural
mapping to boolean true and false.

>   In spirit of CLHS 3.6, consequences are undefined if READTABLE is
>   modified except for modification of the current macro character
>   under traversal.

What rules are there for modification when modifying the current macro
character?  Under the CCL implementation:

unbind the character¹
    No value changes.
make non-dispatching macro character dispatching
    No value changes.
add new sub-character
    No value changes.
set existing sub-character to new function
    Mutates relevant CDR in the fifth value to new function.
unbind existing sub-character¹
    Mutates relevant CDR in the fifth value to NIL.

Likewise, there should also be a rule about modifying structure obtained
via the generator.

¹ ANSI for set-macro-character and set-dispatch-macro-character does not
  seem to specify what passing NIL as the function means, by my brief
  research, or even to allow it (as NIL is not a function designator).

I write stuff at http://failex.blogspot.com/ now.  But the post
formatter and themes are terrible for sharing code, the primary
content, so it might go away sooner or later.

More information about the cdr-discuss mailing list