guile-user
[Top][All Lists]
Advanced

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

Re: macro syntax-error works in prefix but not curly-infix


From: Damien Mattei
Subject: Re: macro syntax-error works in prefix but not curly-infix
Date: Sun, 19 Sep 2021 09:48:57 +0200

thank for your help
i do not understand why, infix is implemented at READER level in the REPL
(READ EVAL PRINT LOOP) and MACRO are expansed at a later level , so my
operator the infix operator should be converted do prefix before macro
expansion in my opinion.
Damien

On Sun, Sep 19, 2021 at 8:23 AM adriano <randomlooser@riseup.net> wrote:

> Il giorno sab, 04/09/2021 alle 16.41 +0200, Damien Mattei ha scritto:
> > hi,
> >
> > i have this macro:
> >
> > (define-syntax <+
> >   (syntax-rules ()
> >     ((_ var expr) (define var expr))
> >     ((_ err ...) (syntax-error "Bad <- form")) ;; does not work in
> > infix !
> >     ))
> >
> > why my syntax-error pattern never reach in infix:
> >
> > scheme@(guile-user)> {x <+ 7 8}
> > While compiling expression:
> > Syntax error:
> > unknown file:3:3: source expression failed to match any pattern in
> > form <+
> >
> > but ok in prefix:
> >
> > scheme@(guile-user)> (<+ x 9 10)
> > While compiling expression:
> > Syntax error:
> > unknown location: <+: Bad <- form in form (<+ x 9 10)
> >
> > why?
> > Regards,
> > Damien
>
>
> As far as I understand, infix syntax can't be achieved through macros
>
> You'd need a custom reader for that
>
> I might be wrong, but at least I offered something
>
>


reply via email to

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