You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Every turtle function should have an optional "done" callback last argument.
For example, "lt 90, -> write 'finished'" should wait until the left turn is finished before writing the message.
Here is why: when learning "await done defer()" with iced coffeescript, the question sometimes comes up, "why can't I wrap await and defer around any function?" By implementing callbacks uniformly around turtle methods that do queuing, the answer can be, "you can do that for any function that can queue an async process."
await lt 90, defer()
This would affect the signatures of a lot of methods: fd, bk, lt, rt, slide, movexy, moveto, jump, jumpto, turnto, home, pen, fill, dot, pause, st, ht, pu, pd, pe, pf, play, speed, wear, reload, twist, scale... However "read" methods that are synchronous such as getxy would not get the optional argument.
Every turtle function should have an optional "done" callback last argument.
For example, "lt 90, -> write 'finished'" should wait until the left turn is finished before writing the message.
Here is why: when learning "await done defer()" with iced coffeescript, the question sometimes comes up, "why can't I wrap await and defer around any function?" By implementing callbacks uniformly around turtle methods that do queuing, the answer can be, "you can do that for any function that can queue an async process."
await lt 90, defer()
This would affect the signatures of a lot of methods: fd, bk, lt, rt, slide, movexy, moveto, jump, jumpto, turnto, home, pen, fill, dot, pause, st, ht, pu, pd, pe, pf, play, speed, wear, reload, twist, scale... However "read" methods that are synchronous such as getxy would not get the optional argument.
The change would look something like this:
https://github.com/PencilCode/jquery-turtle/compare/continuationstyle
Opinions?
The text was updated successfully, but these errors were encountered: