unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Taylan Kammer <taylan.kammer@gmail.com>
To: Maxime Devos <maximedevos@telenet.be>, 48448@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	[thread overview]
Message-ID: <1ee0f4ed-5b13-854e-f95c-66bf11cc33d9@gmail.com> (raw)
In-Reply-To: <1b56d817814d4d1fa08e70578d4aebac909b0aff.camel@telenet.be>

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





      reply	other threads:[~2021-05-15 23:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1ee0f4ed-5b13-854e-f95c-66bf11cc33d9@gmail.com \
    --to=taylan.kammer@gmail.com \
    --cc=48448@debbugs.gnu.org \
    --cc=maximedevos@telenet.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).