Re:Ruby Methods Are Colorless
by dragonwriter on Wednesday July 24, 2024 @10:59AM
(#41057778)
> Any function that calls another that returns a Promise will have to return a Promise to represent completion correctly
No, it doesn't, closures let you update values in the wcope of the parent in .then() callbacks and then you can loop in the function and wait for completion and return a non-Promise value.
Re:Ruby Methods Are Colorless
by modal-soul on Wednesday July 24, 2024 @01:44PM
(#41059657)
This is not true. If your sync function loops until the value is set, then the Promise will never resolve, since it never yields to the event loop.
Any function that calls another that returns a Promise will have to return a Promise to represent completion correctly. That's the color.