Re: Syntax extensions Jakub T. Jankiewicz 06 Mar 2021 16:03 UTC


On Sat, 6 Mar 2021 15:43:01 +0100
Marc Nieper-Wißkirchen <xxxxxx@nieper-wisskirchen.de> wrote:

> > We can simplify the SRFI by requiring for implementation to work in
> > different
> > files. This is how it was working before I replaced tokenizer in my Scheme
> > that return list of all tokens for whole file with incremental Lexer that
> > is
> > tokenizing while the code is parsed.
> >
>
> How would this look like in a typical R7RS Scheme program consisting of a
> top-level program and a number of libraries?
>
> What happens if two libraries try to declare the same prefix independently
> as special?

The specials are global because the parser is single entity. But what about
SRFI-10 if two libraries define same name (e.g. #,(foo ...)) and they use
different implementations. From what I see SRFI-10 don't use any scope and
don't handle the R7RS libraries. The latest library will overwrite the code
that was defined in libraries that were loaded before it if both defined the
name.

Specials (syntax extensions) works the in same way, but instead of same token
#, and function inside, you have different token that also map to name that is
executed. The scope and handling of libraries for both looks similar.

--
Jakub T. Jankiewicz, Web Developer
https://jcubic.pl/me