News for hackers. Stuff that matters.
Re:What's The Point Of Promises? by Strilanc on Thursday March 28, 2013 @03:03PM (#5456957)
The concepts are similar. However:

- Promises don't block the caller. You don't wait, you provide a method to call on completion.

- 'Signaling' a promise (completing it) causes all callbacks to run, instead of just one.

- Promises never transition from completed to not-completed. They settle.

- Promises naturally propagate values.

Semaphores can be useful for implementing a promise, but they're not quite the same.

Re:What's The Point Of Promises? by seivan on Thursday March 28, 2013 @04:51PM (#5457512)
1) Yeah I guess that's what semaphores are for, but the way to mitigate that is to block in a different queue. :-) Not saying this is the right way, I am saying this is part of me refactoring deep nested blocks. It's the middle ground before doing it properly.

2) Not sure what you mean here. A semaphore has a counter. You can signal for one run and only one if you want.

3)Not sure what this means, I suppose I gotta' read up

4) Yeah, this is where semaphores get ugly.

Thanks for taking your time. Appreciate it.