guile-devel
[Top][All Lists]
Advanced

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

Re: Precedence for reader extensions


From: Mark H Weaver
Subject: Re: Precedence for reader extensions
Date: Mon, 18 Feb 2013 18:33:27 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

Hi Mikael,

Mikael Djurfeldt <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]