unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Neil Jerram <neil@ossau.uklinux.net>
To: ludo@gnu.org (Ludovic Courtès)
Cc: guile-devel@gnu.org
Subject: Re: [patch] variable datums with syncase transformer
Date: Wed, 05 Mar 2008 20:55:33 +0000	[thread overview]
Message-ID: <87lk4wao1m.fsf@ossau.uklinux.net> (raw)
In-Reply-To: <87y78xqgdp.fsf@gnu.org> (Ludovic Courtès's message of "Wed, 05 Mar 2008 17:34:26 +0100")

ludo@gnu.org (Ludovic Courtès) writes:

> Note that `@' and `@@' rely on an interesting property of the evaluator:
> you type `(@ (guile) car)', `@' returns a *variable*, but what you get
> is a *procedure*, because in the meantime, the evaluator automagically
> performed a `variable-ref'.  This is not very elegant in my opinion.

However, I think it means that if the variable is then changed, the
code that included the (@ ...) expression will get the new value next
time it is executed.

This means that `(@ module identifier)' acts like a plain old
`identifier', in the sense that it gives you a location - whose value
may change over time - rather than the fixed value of the identifier
at the time the code was first executed.

I think that's a feature, and it's probable that someone somewhere is
relying on it.

> With that in mind, I propose instead the following patch, which also
> fixes your problem AFAICS:
>
> --- /home/ludo/src/guile/1.8/guile-core/ice-9/boot-9.scm.~1.356.2.10.~	2007-09-01 19:11:00.000000000 +0200
> +++ /home/ludo/src/guile/1.8/guile-core/ice-9/boot-9.scm	2008-03-05 17:25:15.000000000 +0100
> @@ -2988,7 +2988,7 @@
>    (let ((var (module-variable (resolve-interface mod-name) var-name)))
>      (if (not var)
>  	(error "no such public variable" (list '@ mod-name var-name)))
> -    var))
> +    (variable-ref var)))
>  
>  ;; The '@@' macro is like '@' but it can also access bindings that
>  ;; have not been explicitely exported.
> @@ -2997,7 +2997,7 @@
>    (let ((var (module-variable (resolve-module mod-name) var-name)))
>      (if (not var)
>  	(error "no such variable" (list '@@ mod-name var-name)))
> -    var))
> +    (variable-ref var)))

If I've understood it correctly, I think this patch would change
existing behaviour, by returning a fixed value rather than a location.

Could we not look at fixing (ice-9 syncase) instead, so that it
understands variables?

Regards,
        Neil





  reply	other threads:[~2008-03-05 20:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-14  8:06 [patch] variable datums with syncase transformer Stephen Compall
2008-03-05 14:59 ` Ludovic Courtès
2008-03-05 15:36   ` Stephen Compall
2008-03-05 16:34 ` Ludovic Courtès
2008-03-05 20:55   ` Neil Jerram [this message]
2008-03-05 22:16     ` Stephen Compall
2008-03-05 23:21     ` Ludovic Courtès
2008-03-06 23:28 ` Neil Jerram

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=87lk4wao1m.fsf@ossau.uklinux.net \
    --to=neil@ossau.uklinux.net \
    --cc=guile-devel@gnu.org \
    --cc=ludo@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).