On 8/22/12, David A. Wheeler <dwhee...@dwheeler.com> wrote: > I said: >> > Here's an alternative: Couldn't the sweet-expression reader peek for an >> > initial "#", and if it's there, re-implement *just* # processing? Then >> > it could include support for the "comment-tag" for #|...|#, but it'd be >> > isolated to the sweet-expression level. That'd isolate it to just the >> > sweet-expression processing. Then neoteric-read would only encounter >> > #|...|# inside a list, where it could recurse without problems. > > Alan Manuel Gloria: >> This sounds like a better idea. The sweet-expression reader already >> does something different when it encounters # at the top-level. > > Okay, that's now implemented in the devel branch. Looks like it works well. > So let's leave #|...|# semantics as they are. We'll need to do more code > simplifications, since that is no longer needed in the lower tiers, and the > sweet-expression implementation is still clunky, but that can be done in > stages.
Wait, the implementation does not seem correct... parse-hash is not assured of leaving the port in a decent state if it returns #f; i.e. it could consume the character after the #. The current Guile implementation behaves decently, but the comments at the top of the file don't reflect that. I think it would be better to copy even more of process-sharp's code rather than calling into process-sharp, so that the standard Scheme syntaxes are considered *before* calling parse-hash. I suppose this is due to a desire to reduce the code size by not rewriting process-sharp. How about, making process-sharp-comment-tag the more "basic" function, and having process-sharp be: (define (process-sharp no-indent-read fake-port) (let ((rv (process-sharp-comment-tag no-indent-read fake-port))) (if (eq? rv comment-tag) (no-indent-read fake-port) rv))) Of course, comment-tag still "infects" underlying read, but I think that's acceptable... Alternatively, make process-sharp return a *list*, i.e. use the same calling convention for parse-hash. Then in the underlying-read, check for '() and recurse if it is, or return the car if not. This alternative removes comment-tag as well, and you can return comment-tag into process-sharp-comment-tag by simply converting '() -> comment-tag and (a) -> a Sincerely, AmkG ------------------------------------------------------------------------------ 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