X-Loop: help-debbugs@HIDDEN Subject: bug#58001: Cannot use 'read' in imported library Resent-From: author@HIDDEN Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-guile@HIDDEN Resent-Date: Thu, 22 Sep 2022 08:06:01 +0000 Resent-Message-ID: <handler.58001.B.166383390514504 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 58001 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: 58001 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-guile@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.166383390514504 (code B ref -1); Thu, 22 Sep 2022 08:06:01 +0000 Received: (at submit) by debbugs.gnu.org; 22 Sep 2022 08:05:05 +0000 Received: from localhost ([127.0.0.1]:36151 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1obHCi-0003lr-H5 for submit <at> debbugs.gnu.org; Thu, 22 Sep 2022 04:05:05 -0400 Received: from lists.gnu.org ([209.51.188.17]:59096) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <author@HIDDEN>) id 1obGfp-0002uL-VS for submit <at> debbugs.gnu.org; Thu, 22 Sep 2022 03:31:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58558) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <author@HIDDEN>) id 1obGfp-0000SG-Ci for bug-guile@HIDDEN; Thu, 22 Sep 2022 03:31:05 -0400 Received: from mout-p-101.mailbox.org ([2001:67c:2050:0:465::101]:33834) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from <author@HIDDEN>) id 1obGfk-0003CP-Ua for bug-guile@HIDDEN; Thu, 22 Sep 2022 03:31:05 -0400 Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4MY6QL6lq6z9sc6 for <bug-guile@HIDDEN>; Thu, 22 Sep 2022 09:30:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=will.party; s=MBO0001; t=1663831851; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=EKalomiv6kMV/ppgUU1VeHVxXjs9kpLBEaMFhoCrSaQ=; b=yySwUrP8x0nhdYeoaNLVMWE/uxYZ8jhLChMhOzmJQCUt/xfoCNKk85sJOMYtvwS2bzek7h toMexq9tUHPIRji3CWlmd83pVA0Li7XPLEhUo171acAc+yY69PVxEiAV5T2+MkFIRC4P60 oOjYdbEWqJRz7G2kMfUc6mhH58ZxJ7yjeJ/a3g52wR2qrJEYPUWb76vhLK8AuwS/ZrySBO jSV4qOQ25zQn7NBgVQiVrbkEhOQR518EGKSuQ3VmiZkinpiPOx3dXVKaSpm89VzIo3o7i7 KWpoR20txxBHMDpubjMyZ2g2KXKBuPOLZoS0KDsGINWJFAIq4eiPsYeNyzYcCA== Date: Thu, 22 Sep 2022 00:30:40 -0700 From: author@HIDDEN Message-Id: <4VOLIR.1V2A6YW618L42@HIDDEN> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-UkZTPNEx7HhUx7tcNAW8" Received-SPF: none client-ip=2001:67c:2050:0:465::101; envelope-from=author@HIDDEN; helo=mout-p-101.mailbox.org X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -2.3 (--) X-Mailman-Approved-At: Thu, 22 Sep 2022 04:05:03 -0400 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) --=-UkZTPNEx7HhUx7tcNAW8 Content-Type: multipart/alternative; boundary="=-8HJF6unqtXxgtH90Z1fP" --=-8HJF6unqtXxgtH90Z1fP Content-Type: text/plain; charset=us-ascii; format=flowed I'm using Guile version 3.0.5 from the Guix repository. I've run into a strange issue with the read function from (scheme base). It cannot be used in an R7RS-style library. This only seems to apply to the read function. Other standard procedures work fine. Let's say you have a library that uses read. Maybe it looks like this: ;; File: foo.scm (define-library (foo) (import (scheme base)) (export read-wrapped) (begin (define (read-wrapped port) (read port)))) Now, let's say you want to import that library somewhere else and use it's exported function read-wrapped: ;; File: main.scm (import (scheme base)) (import (foo)) (display (read (current-input-port))) (display (read-wrapped (current-input-port))) If you try to run that main script (in the same directory as the foo library): GUILE_LOAD_PATH=. guile --r7rs main.scm You can enter get a datum for the first call to read, then you'll get an error for the second call: foo.scm:1:0: In procedure read-wrapped: Unbound variable: read This only happens with read. If you replace read with a different standard procedure like boolean? then everything is fine (you'll see #f twice because the input port fails the predicate). I'm pretty baffled. I've attached the dummy source files for convenience. --=-8HJF6unqtXxgtH90Z1fP Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: quoted-printable <div id=3D"geary-body" dir=3D"auto"><div>I'm using Guile version 3.0.5 from= the Guix repository.<br><br>I've run into a strange issue with the <font f= ace=3D"monospace">read</font> function from <font face=3D"monospace">(schem= e base)</font>. It cannot be used in an R7RS-style library. This only seems= to apply to the <font face=3D"monospace">read</font> function. Other stand= ard procedures work fine.<br><br>Let's say you have a library that uses <fo= nt face=3D"monospace">read</font>. Maybe it looks like this:<br><br><div><f= ont face=3D"monospace">;; File: foo.scm</font></div><div><font face=3D"mono= space">(define-library (foo)</font></div><div><font face=3D"monospace">&nbs= p; (import (scheme base))</font></div><div><font face=3D"monospace"> = (export read-wrapped)</font></div><div><font face=3D"monospace"> (beg= in</font></div><div><font face=3D"monospace"> (define (read-wr= apped port) (read port))))</font></div></div><div><br></div><div>Now, let's= say you want to import that library somewhere else and use it's exported f= unction <font face=3D"monospace">read-wrapped</font>:</div><div><br></div><= div><font face=3D"monospace">;; File: main.scm</font></div><div><div><font = face=3D"monospace">(import (scheme base))</font></div><div><font face=3D"mo= nospace">(import (foo))</font></div><div><font face=3D"monospace">(display = (read (current-input-port)))</font></div><div><font face=3D"monospace">(dis= play (read-wrapped (current-input-port)))</font></div></div><div><br></div>= <div>If you try to run that <font face=3D"monospace">main</font> script (in= the same directory as the <font face=3D"monospace">foo</font> library):</d= iv><div><br></div><div><font face=3D"monospace">GUILE_LOAD_PATH=3D. guile -= -r7rs main.scm</font></div><div><br></div><div>You can enter get a datum fo= r the first call to <font face=3D"monospace">read</font>, then you'll get a= n error for the second call:</div><div><br></div><div><div><font face=3D"mo= nospace">foo.scm:1:0: In procedure read-wrapped:</font></div><div><font fac= e=3D"monospace">Unbound variable: read</font></div></div><div><br></div><di= v>This only happens with <font face=3D"monospace">read</font>. If you repla= ce <font face=3D"monospace">read</font> with a different standard procedure= like <font face=3D"monospace">boolean?</font> then everything is fine (you= 'll see <font face=3D"monospace">#f</font> twice because the input port fai= ls the predicate).</div><div><br></div><div>I'm pretty baffled. I've attach= ed the dummy source files for convenience.</div></div> --=-8HJF6unqtXxgtH90Z1fP-- --=-UkZTPNEx7HhUx7tcNAW8 Content-Type: multipart/mixed; boundary="=-gYlU/vh2KmkZuje5CdgM" --=-gYlU/vh2KmkZuje5CdgM Content-Type: text/x-scheme Content-Disposition: attachment; filename=foo.scm Content-Transfer-Encoding: base64 KGRlZmluZS1saWJyYXJ5IChmb28pCiAgKGltcG9ydCAoc2NoZW1lIGJhc2UpKQogIChleHBvcnQg cmVhZC13cmFwcGVkKQogIChiZWdpbgogICAgKGRlZmluZSAocmVhZC13cmFwcGVkIHBvcnQpIChy ZWFkIHBvcnQpKSkpCg== --=-gYlU/vh2KmkZuje5CdgM Content-Type: text/x-scheme Content-Disposition: attachment; filename=main.scm Content-Transfer-Encoding: base64 KGltcG9ydCAoc2NoZW1lIGJhc2UpKQooaW1wb3J0IChmb28pKQoKKGRpc3BsYXkgKHJlYWQgKGN1 cnJlbnQtaW5wdXQtcG9ydCkpKQooZGlzcGxheSAocmVhZC13cmFwcGVkIChjdXJyZW50LWlucHV0 LXBvcnQpKSkK --=-gYlU/vh2KmkZuje5CdgM-- --=-UkZTPNEx7HhUx7tcNAW8--
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: author@HIDDEN Subject: bug#58001: Acknowledgement (Cannot use 'read' in imported library) Message-ID: <handler.58001.B.166383390514504.ack <at> debbugs.gnu.org> References: <4VOLIR.1V2A6YW618L42@HIDDEN> X-Gnu-PR-Message: ack 58001 X-Gnu-PR-Package: guile Reply-To: 58001 <at> debbugs.gnu.org Date: Thu, 22 Sep 2022 08:06:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-guile@HIDDEN If you wish to submit further information on this problem, please send it to 58001 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 58001: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D58001 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.