robust unhygienic macros Chris Hanson (21 Aug 2022 22:29 UTC)
Re: robust unhygienic macros Ray Dillinger (22 Aug 2022 00:59 UTC)
Re: robust unhygienic macros Marc Nieper-Wißkirchen (22 Aug 2022 06:17 UTC)
Re: robust unhygienic macros Ray Dillinger (23 Aug 2022 02:05 UTC)
Re: robust unhygienic macros Chris Hanson (27 Aug 2022 21:49 UTC)
Re: robust unhygienic macros Marc Nieper-Wißkirchen (28 Aug 2022 15:20 UTC)
Re: robust unhygienic macros Arthur A. Gleckler (28 Aug 2022 20:51 UTC)
Re: robust unhygienic macros Chris Hanson (29 Aug 2022 08:25 UTC)
Re: robust unhygienic macros Marc Nieper-Wißkirchen (29 Aug 2022 15:42 UTC)
Re: robust unhygienic macros Chris Hanson (29 Aug 2022 20:43 UTC)
Re: robust unhygienic macros Marc Nieper-Wißkirchen (07 Nov 2022 13:44 UTC)

Re: robust unhygienic macros Chris Hanson 29 Aug 2022 08:25 UTC

I’m still having trouble understanding exactly what you mean about not
returning raw symbols in their output. Since there’s no code in the SRFI I
can’t read it to figure it out.

If I make the following change to foo, it takes care of the problem:

(define-syntax foo
  (er-macro-transformer
   (lambda (x r c)
     (capture-syntactic-environment
      (lambda (use-env)
        `(,(r 'loop) (exit ,(close-syntax (cadr x) use-env))))))))

This captures the environment in which foo is used, then closes the argument
in that environment, ensuring that it gets the expected binding of exit. But
the raw symbol exit appearing in the output instead gets the exit bound by
loop’s expansion.

I’m pretty sure this isn’t what you are suggesting though. But in the context
of using syntactic closures it pretty clearly specifies what’s supposed to
happen.

Thanks,
Chris

On Sunday, August 21, 2022 11:16:50 PM PDT Marc Nieper-Wißkirchen wrote:
> Am Mo., 22. Aug. 2022 um 00:29 Uhr schrieb Chris Hanson <xxxxxx@chris-
hanson.org>:
> > I’m not familiar with the term "robust unhygienic macros” and an internet
> > search didn’t reveal any definitions.
>
> The term was coined by myself for the purpose of SRFI 211.
>
> > Is there a definition of this term, or better yet, a paper?
>
> Unfortunately no.
>
> What I mean by a "robust unhygienic macro" is an unhygienic macro that
> even works when the unhygienic macro becomes part of the body of a
> second macro expansion.
>
> Please see "Note 2" under "Explicit-renaming macro" for an example.
>
> > I’m a little confused because the SRFI claims that explicit-renaming
> > macros
> > can produce "robust unhygienic macros” yet syntactic-closure macros
> > cannot.
> > However, explicit-renaming is virtually identical to “reverse” syntactic-
> > closure macros, which are syntactic-closure macros with the definition and
> > use environments flipped.
>
> ER macros implemented with SC (syntactic closures) are indeed not
> "robust" (according to my findings). SRFI 211 describes a variation of
> ER (implemented with marks & substitutions) that can be used to define
> unhygienic macros that are "robust". The variation of ER is not 100%
> compatible with how ER is classically implemented.
>
> You can write down the example in Note 2 for SC as well.
>
> Does this help?
>
> Thanks,
>
> Marc
>
> PS My time this week is limited, so please excuse the rather brief reply.