unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#48448: 'procedure-name' returns #f if name is #{}# (the empty symbol)
@ 2021-05-15 18:27 Maxime Devos
  2021-05-15 23:33 ` Taylan Kammer
  0 siblings, 1 reply; 2+ messages in thread
From: Maxime Devos @ 2021-05-15 18:27 UTC (permalink / raw)
  To: 48448

[-- Attachment #1: Type: text/plain, Size: 180 bytes --]

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)


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#48448: 'procedure-name' returns #f if name is #{}# (the empty symbol)
  2021-05-15 18:27 bug#48448: 'procedure-name' returns #f if name is #{}# (the empty symbol) Maxime Devos
@ 2021-05-15 23:33 ` Taylan Kammer
  0 siblings, 0 replies; 2+ messages in thread
From: Taylan Kammer @ 2021-05-15 23:33 UTC (permalink / raw)
  To: Maxime Devos, 48448

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





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-15 23:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-15 18:27 bug#48448: 'procedure-name' returns #f if name is #{}# (the empty symbol) Maxime Devos
2021-05-15 23:33 ` Taylan Kammer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).