GNU bug report logs -
#48448
'procedure-name' returns #f if name is #{}# (the empty symbol)
Previous Next
Full log
View this message in rfc822 format
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
This bug report was last modified 4 years and 31 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.