2017-06-13 5:30 GMT+07:00 Bradley Lucier lucier@math.purdue.edu:
On Jun 11, 2017, at 5:08 AM, Adam adam.mlmb@gmail.com wrote:
Possibly the "macro-force-vars", which is used all over the runtime and
compiler, would have something to do with this, but I don't find its definition anywhere.
In _gambit#.scm:
(macro-define-syntax macro-force-vars (lambda (stx) (syntax-case stx () ((_ vars expr) (if (let* ((co (##global-var-ref (##make-global-var '##compilation-options))) (comp-opts (if (##unbound? co) '() co))) (assq 'force comp-opts))
(syntax-case (datum->syntax #'vars (map (lambda (x) `(,x (##force ,x))) (syntax->list #'vars))) () (bindings #'(let bindings expr))) #'expr)))))
Ah right, https://github.com/gambit/gambit/blob/9c3dcbdc322a10673370c0880696ba13114425... , and used to be a define-macro, https://github.com/gambit/gambit/blob/29103e6a29b8fbbf7d6fc772a344b814be3f1c... , and all the rest of the code is meticulously padded with its use.
This also sheds a bit of light on why the slot containing the promise is not replaced with the forced value. Maybe that would be possible in some situations though.. When |x| is a symbol, it could be |set!| with the forced value?
That would cover standard variable slots and not typedef, vector, pair etc. slots though, I guess I'd need to dig in a bit more to understand how this one actually works out. If you have any spontaneous ideas, feel free to share.
Any idea where in the sources fundamental primitives like |+| , |if| , |or| autoforce?