-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add module jsfetch #12531
Add module jsfetch #12531
Conversation
juancarlospaco
commented
Oct 27, 2019
- Add module jsfetch for fetch support for JavaScript target.
- https://developer.mozilla.org/docs/Web/API/Fetch_API
- Default arguments of the API are also default arguments on this proc. 1-1 copy of the standard.
- Documentation with examples. Tiny code and runs very fast.
This should be a Nimble package. |
I wouldn't include fetch, which is JS specific. |
The JS backend is JS specific, like literally. 🤷♀️ |
Of course, but I think we should strive to provide a stdlib that works both native and in JS. This includes things like the Users that compile to Javascript could use |
That was exactly the idea... |
Sorry, I had assumed that |
My suggestion is to include |
ReSync'd with Devel. |
Why close? |
ya @juancarlospaco could you re-open or explain why you closed? |
My guess would be because this was made on Oct 29, rebased on Nov 29, asked for feedback on Dec 31 and languished ever since |
Ya I have a lot of PR's in similar state, eg #11992 with 18 upvotes and no review after 8 months... but mostly PR's that are left to languish for weeks or months despite all review comments being addressed, CI being green, and rebased against devel. Maybe we should consider some of the options I suggested in https://forum.nim-lang.org/t/4285#26643 (how to increase velocity for merging PRs?) as velocity is still very much a problem, and is discouraging contributors and contributions in a language that desperately needs more user base and contributions. a few points:
I'm excluding from this discussion PR's that are WIP, or with un-addressed review comments, or broken tests (excluding flaky ones). These are not "review-ready", but early feedback is still encouraged for those as early feedback saves time for both reviewer and PR author. On a positive note, I consider important_packages.nim a success that mitigates risks of regressions and maintains a sane ecosystem amongst packages. We should build on that. very non scientific statsnumber of PR's merged over last 30 days, see https://github.com/nim-lang/Nim/pulse/monthly:
|
Well this should have been a Nimble package. Too much stuff is added to the stdlib! |
The problem is that this is needed to support asynchttpclient in the JS target. Since asynchttpclient is already in the standard library, I see no reason to omit this module |
I wasn't aware. |
I am neutral. |
yes, since 1.6 wasn't released yet |
Co-authored-by: Timothee Cour <[email protected]>
Co-authored-by: flywind <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work :)
* Add module jsfetch for fetch support for JavaScript target https://developer.mozilla.org/docs/Web/API/Fetch_API * Update lib/std/jsheaders.nim * Update lib/std/jsformdata.nim * Update lib/std/jsfetch.nim Co-authored-by: Timothee Cour <[email protected]> Co-authored-by: flywind <[email protected]>
* Add module jsfetch for fetch support for JavaScript target https://developer.mozilla.org/docs/Web/API/Fetch_API * Update lib/std/jsheaders.nim * Update lib/std/jsformdata.nim * Update lib/std/jsfetch.nim Co-authored-by: Timothee Cour <[email protected]> Co-authored-by: flywind <[email protected]>
@Araq @andreaferretti I don't see why that justifies putting this straight into the stdlib. You can easily create a Nimble package that implements the httpclient API and then import via: when defined(js):
import jshttpclient
else:
import httpclient In fact, you could even export the right modules from the package to avoid the need for each user to write these |
Well, I assume most applications of Nim compiled to JS would be to make some kind of webapp. And I am pretty sure that most webapps need to contact some API endpoint via HTTP. Leaving out the HTTP client for the JS target seems silly to me. I think it would be worth to have a working, compatible implementation of |
I'm not saying we should never have this in the stdlib, I'm saying we should start this out as a Nimble package, once it becomes stable move it to the stdlib, otherwise we are just asking for problems because our hands are tied if we want to improve the API. Can you explain why we cannot start this out as a Nimble package first? |
No one is going to " improve this API ", |
Fair enough, you're right that the API is unlikely to change for this module. But my assumption is that this won't hold for other modules and it would be best to give them a chance to bake before being included in the stdlib. Once again, I would say this should hold for any new stdlib inclusions. I will again ask, what is the reason this cannot start life as a Nimble package so that it can be iterated on quickly and tested by the wider community much faster? |
Anyone interested feel free to review and describe possible API designs there: #17373 (comment) |