guile-user
[Top][All Lists]
Advanced

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

Re: lazy evaluation: Goops class/instance customization


From: Mikael Djurfeldt
Subject: Re: lazy evaluation: Goops class/instance customization
Date: Wed, 21 May 2003 16:18:01 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux)

Maarten Grachten <address@hidden> writes:

> On Wed, 21 May 2003, Mikael Djurfeldt wrote:
>
>> Why are you using `primitive-eval'?
>> 
>> Shouldn't it be simply "(if (promise? v) (force v) v)"?
>
> Well, without the eval the getter gives me back just the variable, and I 
> want the value of the variable (if there is one, and an unbound variable 
> error otherwise).

Then, in order to get correct semantics, you should remove
`primitive-eval' and instead use the following (untested) version of
make-lazy:

(defmacro make-lazy (specification . body)
  (let ((attributes (map (lambda (x)      
                           (if (keyword? x)
                               x
                               `(delay ,x)))
                         body)))
                `(make ,specification
                       ,@attributes)))




reply via email to

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