[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#48448: 'procedure-name' returns #f if name is #{}# (the empty symbol

From: Taylan Kammer
Subject: bug#48448: 'procedure-name' returns #f if name is #{}# (the empty symbol)
Date: Sun, 16 May 2021 01:33:00 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]