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: with-syntax return error in Guile, not in Kawa or Racket Date: Mon, 6 May 2024 14:03:00 +0200 Message-ID: References: <8a27bbf6579a8f3676ee16ad70afca2efbec2686.camel@abou-samra.fr> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2441"; mail-complaints-to="usenet@ciao.gmane.io" Cc: guile-user To: Jean Abou Samra Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Mon May 06 14:03:54 2024 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 1s3x4S-0000Jg-EO for guile-user@m.gmane-mx.org; Mon, 06 May 2024 14:03:52 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3x3u-0000RM-Vx; Mon, 06 May 2024 08:03:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s3x3r-0000Dy-De for guile-user@gnu.org; Mon, 06 May 2024 08:03:15 -0400 Original-Received: from mail-qv1-xf2e.google.com ([2607:f8b0:4864:20::f2e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s3x3p-0007UQ-Fo for guile-user@gnu.org; Mon, 06 May 2024 08:03:15 -0400 Original-Received: by mail-qv1-xf2e.google.com with SMTP id 6a1803df08f44-69b5ece41dfso8322226d6.2 for ; Mon, 06 May 2024 05:03:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714996992; x=1715601792; darn=gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=+Vyk2NDP5D4tN7uEbG4p85z6s6/co6O3scPq5CDNefU=; b=V99/rweKiFgNgjvhwNz+UBxipXG6SOkAzuGLdxnMvzsOAmgY8FrCRoy6VJYUCZD+Df EDKWYUz3dcCCwdQ0ay4PMdOSbKwSwHTPK6ojYAOwc0zs9qPQwQSZwDSwlSoRM/Ovd+g3 G/YWaM7rLpH1CYOaFhuFggwAt/Eu9dRG3qvCfERM5aU2sENYt+V5JzNJaNM83P3njgam ZWjylenGCJmu6CbiIZT1XdHdLJbPkTVT1jNZTVBvgRYPoPYyPQFsLdA5yPPioIWTGE6L eJcGJ/qqVkK2wflZgFG3n1ssWbgzfnU4oRmfVwA9mJyV/O++Qy7Kz4oyJUvPQE10ECGo qnaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714996992; x=1715601792; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+Vyk2NDP5D4tN7uEbG4p85z6s6/co6O3scPq5CDNefU=; b=JKGyyzibt8D8hiY5z0fHvzGDWpY6/OUbYUqIKwCLF80c0CuaNTGzNZ9UkAJ1oSezWS uIPBm7OQ7uFjp3MbcgatvhMrhONAcftwDgj+osu4JR2AjOzmtGn/MMOcYmofdbVoJTR2 zS1tHLZLjFDJE9CADZN2gkekHZlqqQG1oeZw3cI40p8RHn5g/s1Uz6AxwLTkb8H+BnkP KoofhB/YEuwKYE82i6eR6vexnml69YV635HKc4g2UnImg9I6mg4cefvYvVJshg/6N0y2 5+4xbvA6UegeX23byQLG4e/hBq8qwZ7TnxMYj4/x10FB/um2ZSYyvr8eqxEOJpkke+OK 2I9Q== X-Gm-Message-State: AOJu0Yw9kk16BuvQ94B1vUZba+c8LSQcKOlILq2zHK58u2hHCBnbrUwP nZal9PFiuJOTZgF753klJLiGJGesMYIEjT2IYcKx0uGHt9IzLKayxpPU+Kjt2lFPLLpyXHzXtXq X/EjbLGeCb0NjdLSRS8wdO0w8yNAfZyXWhDY= X-Google-Smtp-Source: AGHT+IHFKTi31eCakrPibSSj3sNfuXRJ6uhRS8B6PYt8DQICfTUNipYneDbZJdTMAVB1qW+nD+WYWaykz7cLLR1ZWiU= X-Received: by 2002:ad4:5741:0:b0:6a0:c934:56c3 with SMTP id q1-20020ad45741000000b006a0c93456c3mr11841713qvx.2.1714996991927; Mon, 06 May 2024 05:03:11 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::f2e; envelope-from=damien.mattei@gmail.com; helo=mail-qv1-xf2e.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.29 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 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-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:19598 Archived-At: about the necessity of 'list it is because optimizer-parse-square-brackets-arguments-lister return a list like this: ((- 6 4) : (+ i 2)) BUT i suspect ,as in scheme , a bit due to homoiconicity of lisp/scheme (that represent code and data the same way) that out of context ((- 6 4) : (+ i 2)) can be evaluated and interpreted as (2 : (+ i 2)) depending of i and then interpreted as (apply 2 (: (+ i 1)) but that is not what i want here and optimizer-parse-square-brackets-arguments-lister was first used in procedure , not pre-compil macro before expansion. about #f , i'm working symbolically, at this stage for optimisation, the context ,and bindings will be evaluated when the expansion of macro is done and then evaluated . Keep in mind ,all that is for testing, beta-code ,and i'm discovering new things about macro, and that my knowledge and the code could change again= . If someone have concrete solution to write better code i will be glad to integrate this in my code. On Mon, May 6, 2024 at 12:29=E2=80=AFPM Damien Mattei wrote: > at any point in any scheme if the user write such a thing: > (let ((list 3)) (list 4)) > there will be a serious problem > > On Mon, May 6, 2024 at 11:41=E2=80=AFAM Jean Abou Samra > wrote: > >> > (with-syntax ((parsed-evaluated-args >> > (datum->syntax #f (cons 'list >> (optimizer-parse-square-brackets-arguments-lister >> > (syntax->datum >> #'args-brackets)))))) >> >> That should work, but it's also non-hygienic. For example, it will >> be affected if the user does >> >> (let ((list ...)) >> (call-your-macro ...)) >> >> and since you use #f in the datum->syntax call, it will also strip away >> all hygiene annotations from the args-brackets, causing problems inside >> that as well. >> >> I'd advise you refactor your >> optimizer-parse-square-brackets-arguments-lister >> function so that it takes #'args-brackets instead of (syntax->datum >> #'args-brackets) >> and works with it in a hygienic way. >> >