GNU bug report logs - #48448
'procedure-name' returns #f if name is #{}# (the empty symbol)

Previous Next

Package: guile;

Reported by: Maxime Devos <maximedevos <at> telenet.be>

Date: Sat, 15 May 2021 18:28:02 UTC

Severity: minor

To reply to this bug, email your comments to 48448 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#48448; Package guile. (Sat, 15 May 2021 18:28:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Maxime Devos <maximedevos <at> telenet.be>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Sat, 15 May 2021 18:28:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: bug-guile <at> gnu.org
Subject: 'procedure-name' returns #f if name is #{}# (the empty symbol)
Date: Sat, 15 May 2021 20:27:27 +0200
[Message part 1 (text/plain, inline)]
guile --version: 3.0.5
In a REPL:

(let ((#{}# (lambda () 0)) (something-else (lambda () 0)))
  (map procedure-name (list #{}# something-else)))
--> $20 (#f someting-else)

[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guile <at> gnu.org:
bug#48448; Package guile. (Sat, 15 May 2021 23:34:02 GMT) Full text and rfc822 format available.

Message #8 received at 48448 <at> debbugs.gnu.org (full text, mbox):

From: Taylan Kammer <taylan.kammer <at> gmail.com>
To: Maxime Devos <maximedevos <at> telenet.be>, 48448 <at> debbugs.gnu.org
Subject: bug#48448: 'procedure-name' returns #f if name is #{}# (the empty
 symbol)
Date: Sun, 16 May 2021 01:33:00 +0200
On 15.05.2021 20:27, Maxime Devos wrote:
> guile --version: 3.0.5
> In a REPL:
> 
> (let ((#{}# (lambda () 0)) (something-else (lambda () 0)))
>   (map procedure-name (list #{}# something-else)))
> --> $20 (#f someting-else)
> 

The problem seems to be that once the compiler produces bytecode,
there is no distinction anymore between a missing name and a name
that is the empty string.

See the procedure link-symtab in module/system/vm/assembler.scm
line 2345.  For every piece of metadata (this includes the names
of procedures), it puts it into the string table, and conflates
a missing name (name = #f) with the empty string:

  (string-table-intern! strtab (if name (symbol->string name) ""))

I'm guessing that changing this would not be worth the effort,
although this isn't my area of expertise.  (I spent more than an
hour trying to figure out the source of the issue, though it was
a great learning experience.)

One could even argue that if you name a procedure after the empty
string... it has no name, right? ;-)

I'm marking this as a minor bug.

--
Taylan




Severity set to 'minor' from 'normal' Request was from Taylan Kammer <taylan.kammer <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 15 May 2021 23:35:01 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 29 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.