From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Damien Mattei Newsgroups: gmane.lisp.guile.user Subject: Re: macro syntax-error works in prefix but not curly-infix Date: Sun, 19 Sep 2021 09:48:57 +0200 Message-ID: References: <9e413208bf72c04fa0d5ce3063a7d68285593173.camel@riseup.net> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7839"; mail-complaints-to="usenet@ciao.gmane.io" Cc: guile-user To: adriano Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sun Sep 19 09:49:37 2021 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mRrZw-0001qW-DD for guile-user@m.gmane-mx.org; Sun, 19 Sep 2021 09:49:36 +0200 Original-Received: from localhost ([::1]:51092 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRrZu-0003U2-Np for guile-user@m.gmane-mx.org; Sun, 19 Sep 2021 03:49:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42802) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRrZY-0003Tk-8D for guile-user@gnu.org; Sun, 19 Sep 2021 03:49:12 -0400 Original-Received: from mail-io1-xd32.google.com ([2607:f8b0:4864:20::d32]:37826) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRrZW-0001ia-K9 for guile-user@gnu.org; Sun, 19 Sep 2021 03:49:12 -0400 Original-Received: by mail-io1-xd32.google.com with SMTP id s20so9294723ioa.4 for ; Sun, 19 Sep 2021 00:49:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=x1KP0hUulTZfTNTpiMCe8DgHBAw4wAezfSQ/m0qlJjM=; b=SpcXKsj95ytI/fdNYwJyElGlCk9+jI7uDUaw1VJk1QKNDlrh79pQyk87Vr7wGSbZHL B1D2Epfyf87iDMddkQc7xZbrmCsEkCXm+5OTE5KQPLrYorGxWmL8VA4GxPjLutzN0Elo Wz4S8AbckJh18eeJETgJjTpwlIV73s6AUNcTGF98p4YVe0QGPb/PK0H7YNQyeJqNpWG0 xoSVh22DC2uINyjCUiQhgarsn41VOa1ZMf9whv5O8JWmVo/B5sh+ehVxd5kN3oITxV3m ioTLqKRUmUGnQ540zf/T8gFIXmEFOereweYbOaI6bhTZxi+UIZpe4L5U5tLgWj9qpBtv 19Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=x1KP0hUulTZfTNTpiMCe8DgHBAw4wAezfSQ/m0qlJjM=; b=c8KgINxSKUY/TMYi+TYssLru6/WRlei4luVCIbzBO3LAIPwiQqWE2li8mKnm0LnbSn aayoHXspHujgrK9XwQsmU5FFIP2OnPn3yVkxL5vV+zzj/m5vHnea6MNaYE90wvFnJ6s6 SrYWLkeqVGMs+LJNkZhwITeGtpQeq2anw0I6LgbkA4FxH+giG3O3oo6OPkoDyv/TOWcJ 4OBF1ZdrzOzfW/vel9bwMWNrZ/hbVnTmo6BbFBrh/POgB6mcl3HNIkSqJjZ5CyWfdFpN 283zZo7/LI7oCZkR1LGUm5TvU8PbpPdiwutK/SuGIrXi6TYRvbR94q/gkf3fVw2uTG4r W70Q== X-Gm-Message-State: AOAM533xmEz1qdl21nju/ZGomIEteYI6omHiL9j6zfNxuP8IMdKqWArB u7HPjfGAW5m7CIlv4MYSP8O1ancOjETaSq7Ibq4= X-Google-Smtp-Source: ABdhPJxgp5bCIrX/1wMJMfR372q5zU1eO06cRFB4jXvV+3ZGjAMHFL6CDE86FbEYD/+AKVkPAPFJQJAZpprvEX+CFzo= X-Received: by 2002:a6b:b842:: with SMTP id i63mr14621949iof.115.1632037747906; Sun, 19 Sep 2021 00:49:07 -0700 (PDT) In-Reply-To: <9e413208bf72c04fa0d5ce3063a7d68285593173.camel@riseup.net> Received-SPF: pass client-ip=2607:f8b0:4864:20::d32; envelope-from=damien.mattei@gmail.com; helo=mail-io1-xd32.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:17752 Archived-At: 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 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 > >