[plt-scheme] set! in lazy.ss

From: Eli Barzilay (eli at barzilay.org)
Date: Sun Jan 28 14:07:20 EST 2007

On Jan 28, jos koot wrote:
> [...]
> However, this leaves me with a question. Is there a reason why the
> set! form requires forcing at toplevel but does not within the body
> of a procedure? I don't understand this and any comment would be
> very welcome.  Jos Koot

Well, it's like any other form in the language -- function bodies have
an implicit begin, and that !s all forms except for the last one,
which is why it works in a function.  Toplevel forms are always
promises which is the real problem.  One of the motivations for the
new `#%top-interaction' special syntax that was introduced in v369.2
is to be able to do `#%module-begin'-like processing for toplevel
forms too -- with that, the lazy language will change to always force
toplevel or module-toplevel forms that are not definitions -- since
there is no point in delaying these forms.  There will also be a
parameter that determines the kind of force you want to use in these
cases -- ! is a good default, but you might want to have !! in some
case, or none at all in other cases (for example, if there is a
DrScheme GUI that allows you to click on values you want to force).

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.