-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

David,

On 13/01/13 04:46, David Rajchenbach-Teller wrote:
> As a base for discussion, I have put together a small RFC based on 
> promises: https://wiki.mozilla.org/RFC/TaskDependencies

You seem to be on the right track. You've probably already worked out
that you'll need to write some dependency code to make sure you
execute the then() and run() calls in the right order. There will also
be some threading considerations to deal with.

Reactive Programming could be viewed as a more general case of what
you're intending to do. You could consider RP to be an enhanced
version of the observer pattern that deals with more system wide
issues and therefore scales better. If you consider your proposal in
terms of RP then you would say:

* A Promise is a Behavior of boolean. It starts as false and becomes
true when something happens, which could be a timer. Behaviors can
contain arbitrary types.
* A Promise can be composed of other promises using boolean operators.
Behaviors can be composed with arbitrary functions
* A Barrier is an Event that fires when a promise changes value.
Events can be triggered when a Behavior changes value and may either
be used to create other Events, or they can have ordinary listeners.

You could trivially write your promise API in terms of Sodium[1].

        https://github.com/kentuckyfriedtakahe/sodium

Anthony


[1] The C++ version of Sodium uses C++11 closure syntax so it requires
gcc >= 4.5 to build.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJQ9benAAoJECKjmZddR/QLtaIIAMtKA67+WIHD3wFTVO0dcVaC
qBrLq+I25TUjn8KsZO7NJ1m6nZcuhOU8JgkX2hDyK03vtoBnGefXqH1RM5IE41Wl
iBnulV9OvdTIhN0SRGmaI3hR+VrRnXGVi41DCFPjMXiLmnNdmdpHF9P/2t/sMZX2
Ve/Ti/YfUZgUqprS8dut4zEnT8wZ8OUKNSHYW6NKWwT9a8ubpesNSn4+72ifJyJa
ZeJbM33JMOFzp1Y56MVl2f6Zn7RcreJhE7Bm4tQ+U037/1oEvD68Qh3vAKksHF9X
vfQnbjcUfMdkPSLoxOCH2eNVReOnxf8p666hIikOBMO4/QigLcAmOKDxQZn8VU4=
=v9am
-----END PGP SIGNATURE-----
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to