Comments (4)
I agree with this sentiment. Just wanted to make it clear that if this is a limitation of repromise, it should be thoroughly documented so that binding authors are aware of the possible pitfalls.
from promise.
@ncthbrt There is now some initial documentation about this in Repromise's new doc site.
from promise.
Indeed, the discussion about that is here: rescript-lang/rescript-compiler#2345 (comment).
The TL;DR summary is: fixing and not fixing this issue both have negative implications for interop with JavaScript, and for now my guess is that it is better not to fix it, however it is only a guess, so please give any information to the contrary (or in support) that you come across.
More detail:
- Functions like
'a => Js.Promise.t('a)
should be pretty rare, and I think most of them will be promise manipulators (likePromise.resolve
, the most obvious function with this type). We don't want people to use these functions from JS anyway, because they are inherently broken. For example, in the case ofPromise.resolve
, we are replacing it with repromise'sRepromise.resolve
. That suggests that it is not very important to fix this. - Fixing it makes interop between repromise and JS promises non-trivial, as one now has to convert repromises to JS promises before passing them to JS, and wrap promises that come back from JS. So there is a definite penalty to fixing this.
For now, I think it's better to
- Push the burden of dealing with functions like
'a => Js.Promise.t('a)
to bindings authors. If an author encounters such a function, we should give them tools like runtime checks for whether the argument is a repromise or not, so they can manually make the binding sound. - Ask people to let us know if any of the assumptions above are wrong, in particular if
'a => Js.Promise.t('a)
is something that occurs commonly in functions people want to bind, and is something we really need to give first-class support for.
And, of course, all of this should be loudly documented as repromise takes shape :)
I want to also point out that none of the above is any way "final." Repromise is an exploration project, we will learn and adapt as we go.
from promise.
Awesome. :)
from promise.
Related Issues (20)
- BuckleScript 8.0.0 breaks listToArray / Promise.all HOT 5
- Reduce compiled size again HOT 4
- Format with refmt? HOT 2
- About the deprecation of the infix operators HOT 2
- Promise.allOkArray never resolves if input is an empty array HOT 1
- Tests: remainsPending appears not to be working
- Converting from Js.Promise HOT 3
- Convert tests to OCaml syntax
- Add a js_of_ocaml variant
- Try an internal module with double underscores to hide "rejectable" from error messages
- Exceptions cause resolution with `undefined` HOT 8
- Provide type abbreviation for promises that reject with Js.Promise.error
- Convert README snippets to ReScript syntax
- Convert to ReScript syntax once there is enough adoption HOT 10
- tap on a rejected promise triggers unhandled promise rejection HOT 3
- Native Example HOT 4
- Example for reason syntax with letop
- Promise.pending/Promise.exec/Promise.resolved
- Align interfaces between native and js versions
- Melange compatibility HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from promise.