guile-devel
[Top][All Lists]
Advanced

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

Re: Special variables to relax boxing


From: Stefan Israelsson Tampe
Subject: Re: Special variables to relax boxing
Date: Sat, 23 Mar 2013 19:31:10 +0100

There are some bugs in the semantics. I try to fix them here


Consider
* k, the r5rs continuation
* dynamic-wind, r5rs dynamic wind with the addition that continuation
k is an argument
   to the rewinder.

 Introduce (with-special ((a:id kind:object) ...) code ...) and
(set~  a:id v:obj)

Introduce
(special-set! i k value)
(special-ref i k)
A setter and a getter of an object indexed by i and k

Also define
(guard-special? k kind)

That index an object on k, wich depedning on kind ask to restore the value
of the old saved state.

Let (make-id) generate a unique object

Then the semantic for with-special in guard mode would be

(let ((last #f)
      (i      (make-id)))
   (dynamic-wind
      (lambda (k)
         (set! last #f)
         (when (guard-special? k kind)
             (set! a (special-ref i k))))
      (lambda ()
         (call-with-values (lambda () (begin code ...))
            (lambda ret
               (set! last #t)
               (apply values ret))))
      (lambda (k . l)
         (unless last
             (special-set! i k a))))

 Guard mode is entered only if a is referenced with set~ and never with
 set! if it can be proved
 Otherwise guard mode is never entered. The semantics of set~ is the
 same as with set! otherwise.

 if with-special is not in guard-mode then it behaves just as (let ()
code ....)

Hope that I don't spam the list but guile is a cooperative effort.

/Stefan



reply via email to

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