From: Damien Mattei <damien.mattei@gmail.com>
To: adriano <randomlooser@riseup.net>
Cc: guile-user <guile-user@gnu.org>
Subject: Re: macro syntax-error works in prefix but not curly-infix
Date: Sun, 19 Sep 2021 09:48:57 +0200 [thread overview]
Message-ID: <CADEOadcg6R-d-ZBGTBYnsAdeX46UgiG5a0P6R3Rx+ynqUzEv3A@mail.gmail.com> (raw)
In-Reply-To: <9e413208bf72c04fa0d5ce3063a7d68285593173.camel@riseup.net>
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
>
>
next prev parent reply other threads:[~2021-09-19 7:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-04 14:41 macro syntax-error works in prefix but not curly-infix Damien Mattei
2021-09-19 6:23 ` adriano
2021-09-19 7:48 ` Damien Mattei [this message]
2021-09-19 12:34 ` Zelphir Kaltstahl
2021-09-20 9:16 ` Damien Mattei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CADEOadcg6R-d-ZBGTBYnsAdeX46UgiG5a0P6R3Rx+ynqUzEv3A@mail.gmail.com \
--to=damien.mattei@gmail.com \
--cc=guile-user@gnu.org \
--cc=randomlooser@riseup.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).