From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Taylan Kammer Newsgroups: gmane.lisp.guile.devel Subject: Re: new function Date: Thu, 23 Sep 2021 22:48:19 +0200 Message-ID: <8dbf9ce5-f01c-94ae-40a2-0fae688f856b@gmail.com> References: <147c2fb4-75d6-7cf6-4f4a-4edd996b0a4a@gmail.com> <9c058f24-5b15-417a-17ff-10bc13fed12d@gmail.com> 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="35391"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 Cc: Jean-Paul Roy , guile-devel To: Damien Mattei Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Thu Sep 23 22:48:39 2021 Return-path: Envelope-to: guile-devel@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 1mTVe2-0008y1-Kk for guile-devel@m.gmane-mx.org; Thu, 23 Sep 2021 22:48:38 +0200 Original-Received: from localhost ([::1]:53384 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTVe1-0006qP-4m for guile-devel@m.gmane-mx.org; Thu, 23 Sep 2021 16:48:37 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57734) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTVdo-0006qD-PY for guile-devel@gnu.org; Thu, 23 Sep 2021 16:48:24 -0400 Original-Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:44967) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mTVdn-0006Vu-6M for guile-devel@gnu.org; Thu, 23 Sep 2021 16:48:24 -0400 Original-Received: by mail-wr1-x431.google.com with SMTP id d6so20705015wrc.11 for ; Thu, 23 Sep 2021 13:48:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=OjvqgFZPQEY8oK7yGxw1U7VExvpOYufZoodQgLthGjY=; b=KCi4DQxDfJtfS0QYvT/EOQ8D8F8awTsimvx/9P7SU+DEmORafZjaGSKk9elOCldymV ife/4U/ai4WWVL8YH5UtHBOnlLG262VVlUhkhLFEjtR4uYcn91MUGR58kMj5fZcwp+bZ fIf3ZBcnUSG1GVTT4OQD/Z2w0Vk8Oj+9sxP/mtRjWtboS54ndPWyDBjYsBKXN3hYfoIr EwXKG7y155sqtFpJLkjI7IgYLsVCjQQpIuhDKIxLrB7cuD6ONZvRInjhJTiTV+jXmEah Lguf0wF+kln8M1z8ItT2/yIqXD5m1pwDlAaOtrlZWk1keXQ05zJflaKwcJL5lAzFU+C9 Altg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=OjvqgFZPQEY8oK7yGxw1U7VExvpOYufZoodQgLthGjY=; b=ZFUeuKWOFB1QAw4gvgCvO0f6EfS/6H7u0BplpDHe65D8Hxi9WGNO+9wFF5zAj30ROP 4+/zwnphkak+5E+lLH2sfG/v69yQz89gPn0kM0kEy7dZ4n72cnKonREVw87ocoTnD0Yt r/ivNBlEwKTq+QSC/2a45Iy+qCd5nEuggceSs6+bEf1LqkIy80wbLlRhNneFDNEng0pY NwZN5NHdmBSD7GRsmfDDju95LcDmBX49c1Gz5fPmsbKdiIQKRJQ9Y+Qt2kWmj9mzaAQ0 lLJ+HA/Ix9+ixBmfZ6lBw/BLZzt+CgGcslM18H7fN+EvCfIeiMYV3+W5VhskcwiWjC5o /atQ== X-Gm-Message-State: AOAM533zE6comW2MHFUIqFeBNyjTpBrkFUEY8AfRD4+zzXUT+1+Lt2Et WXndV6hlRn5Nlr5j9upkJjJdmfpXb74= X-Google-Smtp-Source: ABdhPJwoRrflUlHzxdeij3bL7+C4cW4Lc8Qcs36Kkg3usanWhavBCec35HUhb7/RyFzIazmd/CkENg== X-Received: by 2002:a05:600c:414d:: with SMTP id h13mr18005869wmm.121.1632430101216; Thu, 23 Sep 2021 13:48:21 -0700 (PDT) Original-Received: from [192.168.178.20] (b2b-109-90-125-150.unitymedia.biz. [109.90.125.150]) by smtp.gmail.com with ESMTPSA id 10sm9592403wmi.1.2021.09.23.13.48.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 Sep 2021 13:48:20 -0700 (PDT) In-Reply-To: <9c058f24-5b15-417a-17ff-10bc13fed12d@gmail.com> Content-Language: en-US Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=taylan.kammer@gmail.com; helo=mail-wr1-x431.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, NICE_REPLY_A=-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-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.io gmane.lisp.guile.devel:20884 Archived-At: Responding to myself: On 23.09.2021 22:27, Taylan Kammer wrote: > I can't seem to find syntax-local-binding in Guile 2.2 or 3.0. Did you > have to import some special module, or are you using another version? Worked when I imported (system syntax internal). > Either way, I suspect that the following will not work with your macro: > > (let () > (let () > (<$ x 1)) > (display x) > (newline)) Indeed it doesn't work, though for a different reason: While compiling expression: Syntax error: unknown file:43:8: body should end with an expression in form (let () (<$ x 1)) That's because indeed the inner let expands into: (let () (define x 1)) And there has to be at least one expression after the define. So I tried: (let () (let () (<$ x 1) (newline)) (display x) (newline)) And as I expected, it says 'x' is unbound: ;;; :44:45: warning: possibly unbound variable `x' <$ : global scope : x ice-9/boot-9.scm:1685:16: In procedure raise-exception: Unbound variable: x The only way it will work is if you never use nested scopes, but that will lead to very strange Scheme code, and there will probably be many cases where you accidentally use a nested scope without immediately noticing it. Note also that definitions aren't allowed everywhere. Consider this: (let () (if 'whatever (<$ x 1) (<$ x 2)) (display x) (newline)) It leads to: While compiling expression: Syntax error: unknown file:49:17: definition in expression context, where definitions are not allowed, in form (define x 1) Because the arms of 'if' aren't allowed to be definitions. -- Taylan