From: Andrew Tropin <andrew@trop.in>
To: guile-devel@gnu.org
Subject: Define works different when Compile and Eval
Date: Wed, 19 Jun 2024 13:04:44 +0400 [thread overview]
Message-ID: <875xu5i9qr.fsf@trop.in> (raw)
[-- Attachment #1: Type: text/plain, Size: 947 bytes --]
Here is a snippet of code, which I expect to produce the same result
with both eval and compile, but the results are different.
When compile is used (define a a) sets a to #<undefined>.
Is it a bug?
--8<---------------cut here---------------start------------->8---
(define-module (2024-06-18-define-bug))
(use-modules (system base compile))
(define (peval e)
(compile
e
#:to 'value
#:env (resolve-module
'(2024-06-18-define-bug))))
(define (test-eval teval)
(teval '(define a 1))
(teval '(define a a))
(format #t "a value with ~a is ~a\n" teval (teval 'a)))
(test-eval peval)
(test-eval primitive-eval)
(exit 0)
;; guile -l 2024-06-18-define-bug.scm # output is:
;; a value with #<procedure peval (e)> is #<unspecified>
;; a value with #<procedure primitive-eval (exp)> is 1
--8<---------------cut here---------------end--------------->8---
--
Best regards,
Andrew Tropin
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next reply other threads:[~2024-06-19 9:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-19 9:04 Andrew Tropin [this message]
2024-06-19 9:53 ` Define works different when Compile and Eval Attila Lendvai
2024-06-21 12:33 ` Andrew Tropin
2024-06-22 12:57 ` Attila Lendvai
2024-06-22 16:45 ` Maxime Devos
2024-06-21 14:40 ` Maxime Devos
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=875xu5i9qr.fsf@trop.in \
--to=andrew@trop.in \
--cc=guile-devel@gnu.org \
/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).