Closed Mercerenies closed 3 years ago
A yield* macro that yields from whatever function you call until the function terminates. We could compile it something like (rough example below)
yield*
(yield* (foo))
to
(let ((result (foo))) (while (and (instance? result GDScriptFunctionState) (result:is_valid)) (yield) (setq result (result:resume))) result)
which would (barring weirdness with and requiring the while intermediate form right now) compile to basically
and
while
var result = foo() while result is GDScriptFunctionState and result.is_valid(): yield() result = result.resume() return result
Closed as of 9867fe7. There's some some room to optimize the resulting GDScript, as it is definitely more complicated than the proposed GDScript above, but the GDLisp expansion is identical.
A
yield*
macro that yields from whatever function you call until the function terminates. We could compile it something like (rough example below)to
which would (barring weirdness with
and
requiring thewhile
intermediate form right now) compile to basically