From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Thomas Morley Newsgroups: gmane.lisp.guile.user Subject: Re: Self-evaluating function and closure Date: Sun, 16 Jun 2019 12:21:09 +0200 Message-ID: References: <20190612202929.GA20126@newvzh.lokolhoz> <87o92x3lqm.fsf@netris.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="000000000000c41bbd058b6e3d25" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="32717"; mail-complaints-to="usenet@blaine.gmane.org" Cc: guile-user@gnu.org To: Mark H Weaver Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sun Jun 16 12:24:52 2019 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hcSLD-0008OM-Kb for guile-user@m.gmane.org; Sun, 16 Jun 2019 12:24:51 +0200 Original-Received: from localhost ([::1]:38694 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hcSLC-0004qw-8M for guile-user@m.gmane.org; Sun, 16 Jun 2019 06:24:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49235) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hcSKJ-0004kN-KZ for guile-user@gnu.org; Sun, 16 Jun 2019 06:23:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hcSHs-0007hD-8n for guile-user@gnu.org; Sun, 16 Jun 2019 06:21:25 -0400 Original-Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:39400) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hcSHs-0007gb-1X for guile-user@gnu.org; Sun, 16 Jun 2019 06:21:24 -0400 Original-Received: by mail-wr1-x429.google.com with SMTP id x4so6790460wrt.6 for ; Sun, 16 Jun 2019 03:21:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=H+RkWakluNnf2G+udkdRFOAXc2+9xRncZKT/rOujFSk=; b=c2HkRsZ5oNI7/nH9weTPXuEHS8kuz+9trPL646DLZa0b/pzjQ9uT5pmPJrFp/3uJws naQkockiJIUlaBVjFmNgpsE5gbSRwacvKMzL/HItOdLyyIexkXOMxZ9GgFb2cekTb3nb fAYH5y3dECyNlSeBFsJvn+dHKcGRKvUroiCKPms6yzIXsM0WKu9DxGgYFJ+iUUhuszOB dKM3mrs9vpe/aF8UVA9qT/PZ1H6H9k3OXZfFs0sZPfR+gGOtO+9LXsio7BSNxAZOBndR 7MnR2ttJWJIuPJUGzu1TlP9yQSekZnHYRQtzPFDHriliIdBLKSsQ9USgrEEmfNc9KA1v M4Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=H+RkWakluNnf2G+udkdRFOAXc2+9xRncZKT/rOujFSk=; b=tXs6it3xw5wjougZf1hRfoQYSyl3a3BiPKM5E7iNXdCwXkVXNkQiInLzaJwAGOngdX mQlvaDFlkuG27idERFm0uKLjqtpQEbmxz2KxNk08/yGfEj3XzDjmVkAi+3Cj8O40VAmk gqEFK/5gzs0PIMbusNcimk88jFiB7B+sCg6P+NhUsQl5kvQkR10d/iOqpJUHq2sEXtKr 1lv/dVaECVMPEdhaYgaSLVY3mqPWhgYaCOS4iOxqo4Xhz6uWsBbQFDCy4AyCbThTW2dE k7HP8PesQBDQ84ZIjMgQIgGfjdrTDq1ehRaWfkIgHYLSAYUa9Btdd088ACqOIcLmiUo9 4ebQ== X-Gm-Message-State: APjAAAVh1EqrIuXyGMkACR1BlOoGTz/af670BOQS46GZTN2r4FoxejGG whKMUdyX6Ek08ywVzBf40FfdYisSaaqg3kv29cW4zsEY X-Google-Smtp-Source: APXvYqwBFBMAfueO7joAv3nirxNPT/FOiRW6UpwXFWiwPANC0ZwMD/jDiw8+u3hVhEKZ/2rVTOdPnlYLe45yEtBtpZI= X-Received: by 2002:adf:e3cc:: with SMTP id k12mr14936293wrm.159.1560680482469; Sun, 16 Jun 2019 03:21:22 -0700 (PDT) In-Reply-To: <87o92x3lqm.fsf@netris.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::429 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.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:15559 Archived-At: --000000000000c41bbd058b6e3d25 Content-Type: text/plain; charset="UTF-8" Am So., 16. Juni 2019 um 11:49 Uhr schrieb Mark H Weaver : > > Hello again Vladimir, > > Vladimir Zhbanov writes: > > - Is there a way to work around this (either using the above 'let' > > construct or anything else)? > > I'm not quite sure how to answer this question because I don't know what > your requirements are. > > If you need to generate unique tags, any mutable object will do, e.g. a > vector, list or string with at least one element that is not a literal. > For example, (list #f), (vector #f), and (string #\a) must allocate a > fresh object every time, but (list), (vector), (string), '(#f), #(#f), > and "foo" may return the same object every time. > > If you need to generate a unique _procedure_, there's only one > future-proof way to do it: the new procedure must behave differently > than every other procedure, for some input. > > It's a mistake to expect procedures with equivalent behavior to be > distinguishable in Scheme. If you feel that you need this, I would like > to understand why. > > Note that 'eq?' is the same as 'eqv?' when applied to procedures (and > most other types), and that Scheme 'eqv?' historically implements an > approximation of "operational equivalence". That language was explicit > in the R3RS, which defined 'eqv?' this way: > > The eqv? procedure implements an approximation to the relation of > operational equivalence. It returns #t if it can prove that obj1 and > obj2 are operationally equivalent. If it can't, it always errs on the > conservative side and returns #f. > > with "operational equivalence" defined as follows: > > Two objects are operationally equivalent if and only if there is no > way that they can be distinguished, using Scheme primitives other than > eqv? or eq? or those like memq and assv whose meaning is defined > explicitly in terms of eqv? or eq?. It is guaranteed that objects > maintain their operational identity despite being named by variables > or fetched from or stored into data structures. > > More recent Scheme standards have dropped this language, because the > Scheme authors were not entirely satisfied with this definition and were > unable to formulate a better one, but nonetheless "operational > equivalence" remains the closest thing I've seen to a unifying principle > of the meaning of Scheme 'eqv?'. > > Regards, > Mark > Hi Mark, always interested in guile developments with regard to lilypond I noticed some inconsistence with my local lilypond-using-guile-2.9.2 installation. I think I could break it down to pure guile (no lilypond) (1) The already stated behaviour: ~$ guile GNU Guile 2.9.2 Copyright (C) 1995-2019 Free Software Foundation, Inc. Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. This program is free software, and you are welcome to redistribute it under certain conditions; type `,show c' for details. Enter `,help' for help. scheme@(guile-user)> (define (function-generator) (let ((func #f)) (lambda () (set! func (let a () a)) func))) scheme@(guile-user)> (define x (function-generator)) scheme@(guile-user)> (define y (function-generator)) scheme@(guile-user)> (write (version)) "2.9.2" scheme@(guile-user)> (format #t "\nTEST: ~a" (eq? (x) (y))) TEST: #t $1 = #t (2) Doing it in a .scm-file (attached) ~$ guile --no-auto-compile eq-tst.scm "2.9.2" TEST: #f Did I something wrong or is it a bug? Cheers, Harm --000000000000c41bbd058b6e3d25 Content-Type: text/x-scheme; charset="US-ASCII"; name="eq-tst.scm" Content-Disposition: attachment; filename="eq-tst.scm" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_jwyssoln0 CihkZWZpbmUgKGZ1bmN0aW9uLWdlbmVyYXRvcikKICAgICAgICAgICAgICAgICAgICAgIChsZXQg KChmdW5jICNmKSkKICAgICAgICAgICAgICAgICAgICAgICAgKGxhbWJkYSAoKSAoc2V0ISBmdW5j IChsZXQgYSAoKSBhKSkgZnVuYykpKQoKKGRlZmluZSB4IChmdW5jdGlvbi1nZW5lcmF0b3IpKQoo ZGVmaW5lIHkgKGZ1bmN0aW9uLWdlbmVyYXRvcikpCgood3JpdGUgKHZlcnNpb24pKQooZm9ybWF0 ICN0ICJcblRFU1Q6IH5hIiAoZXE/ICh4KSAoeSkpKQo= --000000000000c41bbd058b6e3d25--