async-interop/event-loop

Standard sync implementation

joelwurtz opened this issue · 5 comments

Don't know if this is the scope of this project, but would a "fake" implementation of an async driver which don't use any implementation and instead call the user land code in a sync way have this place here ?

This is mainly for people who wants to wrote library being compatible on both worlds, so you would in this case write your code in a async way (using promise and other stuff) and then use a default driver which will be this implementation.

So by default user of our library don't have to learn about the whole async stuff, and can then upgrade their knowledge when they want to switch to a "true" async implementation.

@joelwurtz I think it's fine for libraries doing that to make the user add a single line to their composer.json. You can recommend a specific implementation.

@joelwurtz the main problem with a sync implementation is that timeouts won't work. - Things will actually somewhat work… but once the other end gets unresponsive sometime, the program will hang.

In fact i think i can resolve my use case by only use promise which are easy to implement in a sync context, so maybe having more a standard promise "sync" would be helpful, still not sure if this is relevant to have that in the spec ?

Well, the Promises are decoupled from the event-loop and sync/asnyc notion in general.

Yes, so not relevant IMO, sorry for disturbing ^^