On 03.09.2011 3:39, Brendan Eich wrote:
On Sep 2, 2011, at 4:15 PM, John J Barton wrote:
Ok I hope someone creates more tutorial information about
generators. I read about them and played around with some
examples, but I did not come away thinking positive.
You might start with Dave Herman's async library, task.js:
https://github.com/dherman/taskjs/
The code of a complete library is always too complicated IMO to "begin
with". If you want some small examples with detailed comments and
explanations, here they are:
Simple (cooperative) processes with the Scheduler --
https://gist.github.com/1127536
Processes with supporting trampolining -- https://gist.github.com/1130172
and as a bonus -- Primitive Actor-processes
https://gist.github.com/1103751 through the `setTimeout` and browser
scheduling (not about `yield` and tasks, but near).
Dmitry.
Thanks, that's much clearer. So proxies are a generalization of getters.
See also http://brendaneich.com/2010/11/proxy-inception/ (thanks to
Tom and Mark for much of the pretty slideware).
As for the application, reasoning about code that looks like
hash-table lookup but acts very different may not be better than
reasoning about code that looks like spaghetti but acts like you expect.
The two are not easy to trade off. Spaghetti is the bigger problem,
IMHO, since you can make proxies behave well (unlike host objects,
e.g. DOM nodelists, which can be implemented with proxies [with a few
edge-case extensions] but which act like "live cursors").
API design taste is still required to avoid making gratuitously
magical objects. Promises are a non-magical use-case, IMHO.
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss