by Zambyte · 2y ago · 0 comments
(define x 1)
(define t (now))
(display x)
(at t
(set! x 2))
and trying to implement now and at in a way that would behave correctly. I ran into a wall trying to implement it, because I don't think there is a way to define at that could reference the environment that t was defined in. Maybe a more powerful language like Kernel[0] could implement the same features, but I don't think Scheme can. Very cool!Also FWIW here is the definition of now and at that I had before I decided to stop:
(define-syntax now
(syntax-rules ()
((_)
(call/cc
(lambda (k)
(lambda (at-body) (at-body) (k #f)))))))
(define-syntax at
(syntax-rules ()
((_ instant body1 body ...)
(instant (lambda () body1 body ...)))))
[0] https://web.cs.wpi.edu/~jshutt/kernel.htmlIt's an interesting problem, but one that I think is ok not to be able to solve in Scheme.
uh, case in point, that hypothetical closure would have some difficulty crossing module boundries (and that's assuming it gets away with re-writing top-level define forms), but still nothing technically incomputable, just supremely ill-advised and still closer to a reimplimentation of mariposa's semantics than a truely native concept emerging out of the continuations system