-
Notifications
You must be signed in to change notification settings - Fork 9
Closed
Milestone
Description
I noticed that for both delay()
and repeat()
the callback param comes before the time/interval param. This is the same as Amp's reactor interface but different to Icicle and React's event loop interfaces which both place the time/interval param first. The current approach results in code like the following:
$reactor->delay(function () {
//lots
//of
//code
//here
//...
//...
}, 1000);
versus the alternative
$reactor->delay(1000, function () {
//lots
//of
//code
//here
//...
//...
});
The latter seems much easier to grok, which I noticed when re-factoring some code from React\EventLoop today. Has this been discussed or are people pretty happy with the Amp ordering of params?
Note that onReadable
, onWritable
and onSignal
all require the stream/signal nr. params before the callbacks in the current interface, so it's not like the callback is always placed first for consistency reasons.
bwoebi, kelunik, WyriHaximus and trowski