[Top][All Lists]

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

Re: Reader macros

From: Daniel Colascione
Subject: Re: Reader macros
Date: Fri, 23 Jan 2015 03:45:47 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

On 01/23/2015 01:33 AM, David Kastrup wrote:
> Daniel Colascione <address@hidden> writes:
>> On 01/22/2015 03:36 PM, Stefan Monnier wrote:
>>> Maybe we could introduce a more limited form of reader macros.
>>> E.g. allow #<letter><sexp> and make the reader return
>>>    (funcall (cdr (assq <letter> reader-macro-alist)) <sexp>)
>> That's an excellent idea.
> Doesn't work well where <letter> is an unmatched delimiter like ( or [.

So? The point isn't to support every conceivable syntax, but to cover
the most common use cases without fundamentally changing the lexical
structure of the source. Requiring #f() instead of #() is no great crime.

> Also would not work with #r"xxx" raw strings.

Arguably a feature, not a bug.

> I think it makes more
> sense (like Guile does it) to make this kind of funcall not with <sexp>
> but rather with <port>.  If indeed a sexp is wanted, calling `read' is
> trivial.

Sure, it's possible to do it that way, but then reader macros can break
the lexical structure of the program. The only legitimate use case
Stefan's idea doesn't cover is raw strings (and maybe here docs), for
which I would be willing to add a special case to the reader if we
decided we wanted them.

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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