guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Req for help on objects and environments


From: tomas
Subject: Re: Req for help on objects and environments
Date: Mon, 6 Sep 2004 08:17:53 +0200
User-agent: Mutt/1.5.3i

On Fri, Sep 03, 2004 at 07:46:49PM +0100, Andy Wingo wrote:
> Hi Alp,
> 

[...]

> Lexical environments are a different beast. You cannot access them with
> r5rs, I don't think. However, with guile you can, although it's
> definitely not documented. I tried to be less hacky with the following
> macro, but define-macro's memoizing behaviour caused guile 1.6 to
> segfault, so I had to use low-level macros:
> 
> (define make-environment
>   (procedure->syntax
>    (lambda (exp env)
>      (local-eval `(let* ,(let lp ((in (cdr exp)) (out '()))
>                            (if (null? in)
>                                (reverse out)
>                                (lp (cddr in) (cons
>                                               (list (car in) (cadr in)) 
>                                               out))))
>                     (the-environment))
>                  env))))

Thanks for your insightful post. As a (mostly) lurker and (currently) non-
schemer (shame!) I appreciate this.

Suggestion: Maybe call your macro make-local-environment -- that might help
newbies to keep apart those two beasts better.

Regards
-- tomás




reply via email to

[Prev in Thread] Current Thread [Next in Thread]