Handling #|...|# creates a lot of implementation complexities and 
otherwise-unnecessary interdependencies.  Handling #|...|# has multiple changes 
all the way through the code that are otherwise unnecessary, and create easy 
opportunities for bugs.  The same is true for #!...!# if they have similar 
semantics.

Only the sweet-expression reader really needs to handle #|...|# specially.  We 
could create a special routine that calls the neoteric-reader, but handles 
#|...|# specially instead, isolating the code more.  Implementation methods are 
all ugly that I see; they include:
1. Peeking two characters ahead.  Not portable in either Scheme or Common Lisp 
at *least*.
2. Modifying the underlying hash table for #|...|#, and then having the 
neoteric-reader modify the table again on recursion.  Basically, the readers 
constantly manipulate the table.  (Better not have parallelism!)

Yuk. A *much* simpler approach would be to change the spec so it's trivial to 
implement.

PROPOSAL: Change the semantics of #|...|# for the sweet-reader to: "All 
whitespace and ;-comments after multi-character comments are consumed; the 
datum is considered to begin where the comment began.  This is because a 
#|...|# comment is read recursively by the neoteric reader."

Under this semantic, this would work unchanged:
#|
hello
|#
define x 5


And this would also be unchanged:
define x #| Clever thought goes here. |# 5


This *WOULD* be changed; it becomes "define x 5":
define x #|
Whitespace and comments after multi-line comments are ignored
|#

; This is ignored too, because the neoteric-reader is trying to find something 
to read.
5


Perhaps this is less "pure", but it seems to me that people shouldn't normally 
do that anyway.  As long as we clearly define the result, I think we're okay.

The result would be a MUCH MUCH simpler and cleaner implementation.  The reader 
implementations would go back to being simple and not interdependent.  I think 
simple implementation is important; we want to get this widely adopted, and 
anything that makes it hard to implement may slow adoption.  And I don't think 
supporting the current semantic is really that important, certainly not enough 
to create the complicated implementation.

Thoughts?  Comments?

--- David A. Wheeler

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Readable-discuss mailing list
Readable-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/readable-discuss

Reply via email to