unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Attila Lendvai <attila@lendvai.name>
To: Andrew Tropin <andrew@trop.in>
Cc: guile-devel@gnu.org
Subject: Re: Define works different when Compile and Eval
Date: Sat, 22 Jun 2024 12:57:45 +0000	[thread overview]
Message-ID: <MlufnAmNXWg6rGuCC5U4zvg51lg6nVcfb8rQAPVcbZFS1a9acB3I1rEz4j2sxkITfTS0H9bHQEqZixZ8DPbrv_cbPoYCBNV8604pnJHALOs=@lendvai.name> (raw)
In-Reply-To: <87r0cq8ogp.fsf@trop.in>

> > if you want this^ to be actually defined while compilation is
> > happening (i.e. in the compilation stage; see staged computing), then
> > you need to use an (eval-when (expand) ...) wrapper around it.
> 
> 
> Thank you for the reply! Not sure what you mean. The following code
> defines `a`:


i ran with some ungrounded assumptions, and i basically explained how it works in CL, not in Guile.

sorry about that!

i played a little with your test now.

maybe i'm stating the obvious here, but its behavior is in harmony with the hypothesis that the compilation of DEFINE (wrongly) evaluates the value in the newly updated environment (as opposed to the "parent" environment, i.e. the one before the definition has been added/set).

i briefly tired to find the place where DEFINE is compiled to check this hypothesis in the code, but i couldn't find it.

-- 
• attila lendvai
• PGP: 963F 5D5F 45C7 DFCD 0A39
--
“I find television very educating: Every time somebody turns on the set, I go into the other room and read a book.”
	— Groucho Marx




  reply	other threads:[~2024-06-22 12:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-19  9:04 Define works different when Compile and Eval Andrew Tropin
2024-06-19  9:53 ` Attila Lendvai
2024-06-21 12:33   ` Andrew Tropin
2024-06-22 12:57     ` Attila Lendvai [this message]
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='MlufnAmNXWg6rGuCC5U4zvg51lg6nVcfb8rQAPVcbZFS1a9acB3I1rEz4j2sxkITfTS0H9bHQEqZixZ8DPbrv_cbPoYCBNV8604pnJHALOs=@lendvai.name' \
    --to=attila@lendvai.name \
    --cc=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).