I have an idea, and wonder about the pros and cons.  The basic idea is, "what 
if initial whitespace (space/tab) at the toplevel DISABLED I-expressions?"  
(this is the REVERSE of my earlier approach).

There are two pros to this:
1. It enables reading of more existing s-expression files.  For example, 
currently, if you have:
 (setf f 1)
 (setf g 2)
where both are indented, the indent of the first one is ignored, and the result 
is ((setf f 1) (setf g 2), which is NOT what the original author intended.  
Similarly,
 (setf f 1) (setf g 2)
where there's more than one expression on the line will produce the same 
unintended thing currently.
With this new rule, once the processing of (...) ends because of any 
whitespace, you're done, making it more compatible.  Thus, stuff like:
 (a b c
     d e) (f g)
would be interpreted "as originally intended".

2. It enables relatively easy command-line interactions.  Currently, if you 
have many one-line interactions at the command line, you have to press ENTER 
ENTER after each one.  Ugh; not only is that more keystrokes, but that quickly 
consumes precious vertical space.  If users insert a space before a one-line 
command, it can be executed immediately.


The big con to this, of course, is that this is ANOTHER rule, and every rule 
makes things more complex for users.  It's not clear that this rule is worth 
it, or if there are hidden traps.

As usual, I hope to brainstorm many ideas until the "best" set wins.  So here's 
another, let's discuss.

Originally I had proposed using indentation to REQUIRE indentation 
interpretation.  But that doesn't work well, because of limitations on peeking 
(one-char-only) and unget (Scheme has none, Common Lisp only one char).  
Reversing the meaning seems to eliminate this problem; you don't need to look 
through multiple characters to "see if you're done". That's because if 
indentation processing is disabled, once the expression is read (which you can 
tell with one-char peek), you're done.  And by peeking, you can leave behind 
the whitespace to continue this interpretation the next time read is called 
(which is nifty).

--- David A. Wheeler 

Reply via email to