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

TTYSCAN troubles--doing something wrong

The comment was made that if you are having side-effects at read-time
you must be doing something wrong.  Clearly, the reader already does so,
but we tend not to think of extra interned atoms as a terrible problem.
In my application, I am providing other, non-atomic, unique-ized
expressions, which are also indexed to others of their kind.  The only
mechanism I know which supports this reasonably IN NOTATION is to use a
reader macro which then SQUIDifies its result, so that expressions like
                       (setq foo '(a b [c d] e))
where the [c d] will never get eval'd, work out right.  Then, however,
if I type [a [b c] d], the inner [b c] will be created and indexed
before the expression is complete, and then I may rub it out.  I agree
that this case could be hacked by making the [b c] realize that it is
inside another expression and not construct its meaning but merely
indicate to the outer expression how to construct it when the outer one
is done, but that is a rather filthy way to program.  I like GSB's
suggestion, of a global flag that says "don't care about the value"
better, because it allows each function to decide locally what to do
without having to understand another notation for what its subsidiaries
want.  (E.g., what about [a {b <c> d} [e]]--God forbid.)
	I still think that if you are going to retain the current
TTYSCAN mechanism, you ought at least to add to it the flexibility to
handle everything but the "arbitrary macro character" case correctly.
I'd bet that nearly all of what arbitrary read macros do can, for the
purposes of prescanning, be described in terms of four or five standard
schema (the small infinity theory of Waltz).  My (partial) list: 1.
initial string delimiter (e.g.,|;"), 2. initial of nested bracket pair
(e.g., ([{<--possibly, though only ( in lisp now), 3. quote-like thing
(e.g., '`#), 4. slash-like thing (e.g., /).  Can anyone think of others?
Each of these categories has uniform prescanning implications.