-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Callbacks vs promises #232
Comments
Hello Dominique( @dontcallmedom ) -san,
Honestly, I have to say that there is no strong reason. Histroically saying, I took over the editor's task from my successor around April 2017 and originally it was callback style. At the time, I did not push to 'promise' direction as well with minor reasons such as
After that, I had been busy for other task and not updating VIAS for sometime. @dontcallmedom , |
Mandatory is probably too strong of a statement, but I can't think of any recent asynchronous Web API that would still be using callbacks. Promises aren't perfect, but they have much cleaner semantics, and they play very well with Naturally, VIAS can be wrapped into promises - but since VIAS is itself a wrapper to the protocol, this starts to be lots of wrapping :) (note that I am personally unconvinced that a standard wrapper is needed at all - see #233) |
Thanks for the comment. That sounds reasonable to me. I'd like to hear if there is other people who have opinion on this issue? |
I am on the position with promise rather than callback. Because that is promitive JS feature for supporting async call and which provides a clear benefit for developing and maintaining the program code. |
@wonsuk73 Not being a web developer could you show by a simpe example what you mean ? |
@peterMelco There are many articles to compare the two different approaches (callback and promise). Below article is good simple note for differences between them. |
@wonsuk73 , @peterMelco
I suppose this may be good timing to change |
+1 for promise where both are ok.
I'm not sure that all callback can be changed to promise.
…On Mon, Sep 25, 2017 at 1:49 PM, Shinjiro Urata ***@***.***> wrote:
@wonsuk73 <https://github.com/wonsuk73> , @peterMelco
<https://github.com/petermelco>
Thanks for the comment.
I am on the position with promise rather than callback.
I suppose this may be good timing to change get() and set() to promise
style.
Please let me know if other members has affirmative/negative opinion.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#232 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AA-qroSz9u7PbEd9hCfas4DTYTpJe8lAks5slzDugaJpZM4PbAD6>
.
|
@sou3ilow -san, thanks for the comment ! |
I'm sure that all callbacks can be replaced with promises or other ways. Apart from @aShinjiroUrata's comments on why we chose the callbacks above, there seems a discussion in the last f2f meeting in #198. I would like to put some comments to consider reasonable designs of VIAS. I hope we can finalize the work while properly solving the concerns on VIAS, even though it would be a WG note or a reference for the relevant library as raised in #233. I believe that VIAS is a valuable work in terms of making the web apps easily access the VIS server.
|
Thank you very much for the valuable comments, @anawhj -san.
|
- updated method definitions - 'subscribe' is left unchanged - updated examples
For issue #232, revise oneshot method to Promise style
Excuse me to become so late. Then, close this issue. |
VIAS uses callbacks for its asynchronous operations, when most of the JS world has moved to promises (which also enables usage of the new
async
/await
ecmascript keywords).Is there any reason to prefer callbacks to promises?
The text was updated successfully, but these errors were encountered: