dabeaz / curio

Good Curio!
Other
4.04k stars 243 forks source link

Prototype Promise class for discussion. #191

Closed alexchamberlain closed 7 years ago

alexchamberlain commented 7 years ago

Simple Promise prototype, with basic get/set and exception handling.

Open questions include:

ToDo

Thoughts? Any other test cases needed?

njsmith commented 7 years ago

It looks like you're reimplementing curio.Event along the way here?

alexchamberlain commented 7 years ago

It is very similar, indeed. Do they serve the same purpose? If so, maybe it would be sufficient to add data/exception elements to Event.

njsmith commented 7 years ago

I don't think it makes sense to add data/exception elements to Event, but an Event could replace your done bool + condition variable. (You'd use the condition variable's locking, but it isn't doing anything here anyway, because you never hold the lock over a yield.)

alexchamberlain commented 7 years ago

Done; I've left it as 2 commits, but can squash before this is landed.