Re: First comments Linus Björnstam 10 Jun 2020 08:20 UTC

On Wed, 10 Jun 2020, at 09:37, Marc Nieper-Wißkirchen wrote:

> How do you want to correctly check for nested syntax? Recursively
> scanning the forms would be broken because some of the forms may be
> binding constructs, other maybe macro calls whose effect you don't know:
>
> (megacut (display '%3)) => ???
>
> (megacut (let ((%3 'foo)) (display %3))) => ???
>
> (let-syntax ((foo (identifier-syntax %3)))
>  (megacut (display foo)) => ???
>
> It's pretty clear what "???" should be under the Scheme hygiene rules.
> But it is not so clear to me how to implement it. With syntax
> parameters, one would get the lexical scoping right, but how do you
> then check for the highest parameter number used?

I carefully refrained to call my code hygienic. I said that the part detecting nested use is less hygienic than it can be. I am very well aware of the issues with the rest.

This is why I have refrained  from doing it before: doing it in a way other than "here is some code. Use it responsively because it might not work in some cases" is prohibitively hard. Saying "don't do x y z because this is just a hack" feels icky. Especially since you know someone learning the language will inevitably try it :)

I use the shorthand mostly at the repl where it saves quite a lot of key presses, but that isn't really a reason to srfi it. If there is interest I could probably make something that will leave everyone feeling slightly unsatisfied, but that is about it. I just thought I should ask the question.

>
> >
> >  It could be worded in a way to allow for syntax-rules implementation, allowing limiting it to <1> to <10>, <> and <...>.
> >
> >  I would not want to write that syntax-rules macro though :)
>
> You could implement it with SRFI 148, thereby proving than an
> implementation with `syntax-rules' alone is sufficient.
>