unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
Cc: Guile Users <guile-user@gnu.org>
Subject: Re: Req for help on objects and environments
Date: Wed, 22 Sep 2004 19:07:24 +0200	[thread overview]
Message-ID: <1095872844.3468.35.camel@localhost> (raw)
In-Reply-To: <87y8j3tkm8.fsf@zagadka.ping.de>

Hey Marius,

On Tue, 2004-09-21 at 22:47 +0200, Marius Vollmer wrote:
> It is best not to fiddle with the implementation of lexical
> environments (expect when you are writing a debugger, say).  Something
> like the following might be sufficient and is cleaner.
[...]
>     (define-macro (with-env env . body)
>       (let ((module (current-module)))
>         `(let ((code (cons* 'let ,env ',body)))
>            (eval code ',module))))
> 
>     (define env (make-environment 'a 12 'b 13))
> 
>     (pk (with-env env (+ a b)))

Yeah, I think I would have done this if I hadn't needed to keep state in
the environment. I agree it's ugly though -- it would be impossible to
compile this code, for instance, because it violates the
implementation's prerogative to implement environments as they like. I
should probably implement my stuff with anonymous modules.

Regards,
-- 
Andy Wingo <wingo@pobox.com>
http://ambient.2y.net/wingo/


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


  reply	other threads:[~2004-09-22 17:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-01  8:28 Req for help on objects and environments Alp Öztarhan
2004-09-03 18:46 ` Andy Wingo
2004-09-06  6:17   ` tomas
2004-09-21 20:47   ` Marius Vollmer
2004-09-22 17:07     ` Andy Wingo [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-09-02 11:09 [Fwd: Req for help on objects and environments] Alp Öztarhan
2004-09-02 11:53 ` tomas
2004-09-03 19:10   ` Req for help on objects and environments Andy Wingo

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=1095872844.3468.35.camel@localhost \
    --to=wingo@pobox.com \
    --cc=guile-user@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).