[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


    From: Chris Riesbeck <Riesbeck>
    To:   T-Discussion

    Linking read-tables to streams seems like a good idea, but I'm confused.
    What do I write in a file that defines a readmacro?

Good question.


This works, if everyone who wants the read-macro will be using
resource, with its accompanying management problems.

          (SET (READ-TABLE-ENTRY *MY-READ-TABLE* ...) ...)

This might be better.  My opinion is that every major system is going to
have to decide just what read syntax it wants to be using, and should do
this kind of thing explicitly.  Seems the user should always obtain
read-macros explicitly, either by modifying his favorite read-table
or by using a read-table set up by his favored total environment.

          (HERALD MYFILE
                  (READ-TABLE *MY-READ-TABLE*))
          (SET (READ-TABLE-ENTRY *MY-READ-TABLE* ...) ...)

Notice that this might not work because the (SET ...) won't necessarily be
evaluated until after the whole file is read, so the definition isn't
available in the file which defines the read-macro.  (Consider what
happens when the file is compiled.)

This will work fine as long as a fully initialized read-table already
exists before anyone wants to use it; that is, if the (SET ...)
isn't in the same file as the HERALD.

You might try something like

          (HERALD MYFILE
                  (READ-TABLE (BLOCK 
			       (DEFINE *MY-READ-TABLE* ...)
			       (SET (READ-TABLE-ENTRY *MY-READ-TABLE* ...) ...)

or even

          (HERALD MYFILE
                  (READ-TABLE (LET ((MY-READ-TABLE ...))

which may be considered either horrible or elegant, depending on your taste.
I have no comment at this point.

If we can get all this worked out, then we'll have an environment with
the marvelous property that different people can use their own favorite
syntaxes for their own files, without having problems when using files
written by other people.  Syntax tables and locales provide parallel
modularity features for managing incompatibilities on the other semantic
levels.  Not everyone may appreciate the hassle now, but I think the
effort will pay off very big at some indefinite future point.