On Thursday, September 1, 2016 at 4:19:02 PM UTC+2, Thomas Broyer wrote:
>
>
>
> On Thursday, September 1, 2016 at 4:10:12 PM UTC+2, Jens wrote:
>>
>>
>> var _symbol$bar = Symbol("Foo.bar");
>>> class Foo {
>>>   async getBar() { // Note: transformed to 'async', no 'synchronized'
>>>     if (this[_symbol$bar] == null) {
>>>       var realBar = …;
>>>       this[_symbol$bar] = await realBar.get(); // transformed to await
>>>     }
>>>     return this[_symbol$bar];
>>>   }
>>> }
>>>
>>
>> I think this isn't even correct, because "async getBar()" does return a 
>> promise simply because its marked async. Given that you can only call await 
>> inside async functions I think its nearly impossible to map that to a 
>> synchronous Java function while keeping the correct return type or am I 
>> missing something?
>>
>
> That was part of Ian's proposal (emphasis mine):
>
> “If it makes it all the way to a function exposed with JsInterop, then *that 
> function changes signature like the rest of them to return a promise*. 
> The consumer of this function is obviously in JS and so can handle the 
> promise fine. This would equate to translating the synchronous java calls 
> which wait on a CompletableFuture (Promise) to return promises in JS.” 
>

…and yes, that'd mean that one small change in one class could change the 
exposed API from/to a Promise "at the other end" of your project. Good luck 
tracking those changes and never introduce a bug because of them ;-)

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to