From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Zelphir Kaltstahl Newsgroups: gmane.lisp.guile.user Subject: Re: macro syntax-error works in prefix but not curly-infix Date: Sun, 19 Sep 2021 12:34:27 +0000 Message-ID: <44267709-9cc3-5185-86b7-02adc7a17d1e@posteo.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20311"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Guile User To: Damien Mattei Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sun Sep 19 14:34:47 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 1mRw1v-00057q-O9 for guile-user@m.gmane-mx.org; Sun, 19 Sep 2021 14:34:47 +0200 Original-Received: from localhost ([::1]:36160 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRw1u-00075D-1V for guile-user@m.gmane-mx.org; Sun, 19 Sep 2021 08:34:46 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42544) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRw1j-00074p-RW for guile-user@gnu.org; Sun, 19 Sep 2021 08:34:35 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:32799) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRw1g-0000x7-R9 for guile-user@gnu.org; Sun, 19 Sep 2021 08:34:35 -0400 Original-Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 4F2ED240104 for ; Sun, 19 Sep 2021 14:34:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1632054869; bh=UZ/2f4U8qvMGQ5rnZiMuBIfRrFvHvRBR4BORZ8u2GCE=; h=Subject:To:From:Cc:Date:From; b=Ca92RiphNuIJaOjtVtO8Ls6n95ZC8dVBlu1wYDlvUTGDSqAc3HAczxxM2b3OeJuSv Gswribn/vdqsUhMgxIGTukC3YWCcvrpqEcQjUglD+BoJ09F5etv/5SeexvogbJffW/ 2iYSEjWO6/8KbDJRSttKQnPTEUiaSbm0QXUJPdgDJPG8fkJyboiMw5R6g9SedWumFd eLTKfohouKSPgN5ZMyTu5JyjYBjrDafKbKiqWUUQ63vMy/QHcddMyfyVYFG0UAhuvl Bx7GNCL+bQ83KqoMspaG0AYBbvZhHJp01rn+zF9LZjT9qKJSzcsMesYZX+SqkfUU5D BSRWk7UnI28nQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4HC6ZX34Tzz6tmR; Sun, 19 Sep 2021 14:34:28 +0200 (CEST) In-Reply-To: Content-Language: en-US Received-SPF: pass client-ip=185.67.36.66; envelope-from=zelphirkaltstahl@posteo.de; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, 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:17757 Archived-At: Hi Damien! I think there might be too few expressions matched in the first case: (_ var expr). Wouldn't it have to be: ~~~~ (_ var expr1 expr2) ;; or (_ var exprs ...) ~~~~ for ~~~~ (<+ var expr1 expr2) ~~~~ to work, simply because of the number of expressions there? But then you might need to use ellipsis in the resulting syntax somewhere, otherwise you get: ~~~~ syntax: missing ellipsis in form (syntax (define var expr)) ~~~~ I don't know where that would go, but I also do not understand yet the goal. I think it is best to always describe, what you want to achieve, when you write a macro. Regards, Zelphir On 9/4/21 4:41 PM, Damien Mattei wrote: > 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 -- repositories: https://notabug.org/ZelphirKaltstahl