You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Interesting discussion came up internally at Mozilla around what should happen when you have a .method() that returns a promise. We were discussing annotating methods with [NewObject] for promise returning .method()... question that came up was, should a promise returning method always return a newly created promise? Or are there cases where it makes sense to return the same Promise, representing some ongoing operation.
For example:
constp1=Tasks.doTask("some-id");constp2=Tasks.doTask("some-id");awaitPromise.all([p1,p2]);constp3=Tasks.doTask("some-id");// obviously a new promise!
As p1 and p2 represent the same task, would p1 === p2 or p1 !== p2? My personal preference is for always getting new promises object, but some guidance would be great.
The text was updated successfully, but these errors were encountered:
If t1 === t2 then why p1 !== p2? It seems like you'd just be creating implementation complexity for no benefit, or is there a benefit I'm missing? Obviously if t1 !== t2 then p1 !== p2 must be true as well.
Interesting discussion came up internally at Mozilla around what should happen when you have a .method() that returns a promise. We were discussing annotating methods with [NewObject] for promise returning .method()... question that came up was, should a promise returning method always return a newly created promise? Or are there cases where it makes sense to return the same Promise, representing some ongoing operation.
For example:
As p1 and p2 represent the same task, would p1 === p2 or p1 !== p2? My personal preference is for always getting new promises object, but some guidance would be great.
The text was updated successfully, but these errors were encountered: