Hi Mikael, Mikael Djurfeldt <mik...@djurfeldt.com> writes: > I'm working on an mit-scheme compatibility module (compat mit-scheme) > enabling Guile to read a (so far) subset of mit-scheme code. > > Now I have the problem that mit-scheme has the two constants > #!optional and #!rest (mit-scheme extensions to the scheme standard). > > I thought that I could support this using %read-hash-procedures but > discovered that there are three "precedence levels": > > 1. Most predefine hash syntax like #(, #! etc. > 2. %read-hash-procedures > 3. #| > > This means that I can't add new syntax for #!. > > I propose to simplify this to only two levels: > > 1. %read-hash-procedures > 2. predefined syntax
I don't think this would be sufficient. The problem is that tokens of the form "#!<symbol><delimiter>" have become standardized. To name a few examples, both R6RS and R7RS define the reader directives #!fold-case and #!no-fold-case, R6RS has #!r6rs, and SRFI-105 has #!curly-infix. Guile also has #! ... !# block comments to help with the handling of executable scripts. One idea would be to provide a way to register new handlers for tokens of the form "#!<symbol><delimiter>". However, we'd probably want to discourage its use, because every time you add a new token, you potentially turn existing #! ... !# block comments into lexical errors. Thanks for working on scmutils for Guile! I've been wanting this for a while :) Mark