Has there been any discussions around standardizing socket or file io usage?
Le 17/06/2016 06:44, Kris Siegel a écrit :
I didn't see this in the archives but I was curious if any consideration has been given for standardizing on features more commonly found in most other language's standard library.
For example reading and writing to sockets in JavaScript requires platform specific libraries and works very differently between them. The same goes for file io (which would obviously need restrictions when run in, say, a web browser).
Building these in would make JavaScript more universal and easier to learn (you learn one way to access a resource instead of 2 or 3 very different ways).
I would be happy to work on a proposal for such changes if they were desired by the community. Thoughts?
I understand your motivation, but I believe standardisation isn't the right avenue for the problem you describe to be solved.
Specifically, even if there was a standard why would Node or browser makers implement it given they already have an API for the job and lots of code is already written on top of these APIs?
Writing a standard is not a guarantee for implementation. Implementing something is lots of work for browser vendors and Node.js (and they're not in shortage of things to do), so they usually need some confidence that the new thing adds enough value to be worth the cost. One way to convey such confidence can be to start the work, implement it as a library on top of current APIs, show that there is adoption by lots of people. Adoption is usually is an excellent proxy for value. That's how we got document.querySelectorAll (via jQuery) and Promise (via the gazillion promise libraries and Promise/A+ spec) for instance.
In this case, from experience reading proposals on standards mailing-list come and go, I doubt this will be of interest to enough people to be worth it. But that's just my own opinion and I would love to be proven wrong.
One more thing to regret, maybe www.youtube.com/watch?v=7eNFQqMSxtU
On 6/17/16 10:35 AM, David Bruant wrote:
Specifically, even if there was a standard why would Node or browser makers implement it given they already have an API for the job and lots of code is already written on top of these APIs?
The other issue, of course, is that Node and browsers have very different security models, which has a significant impact on how a feature like this would be exposed. The ideal API for one security model may not match the ideal API for the another one...
How does WebSockets fit into this?
For server-side, you might want to look into the CommonJS standards, which Node itself was based on from its conception. There's the file system API, the console API (different from browsers), the event emitter API, the module standard (which Node purely extended) and even the precursor to Promises/A+ and ES2015 promises, the CommonJS Promises/A standard. Interesting historical read.
(By the way, that group still operates, but it's not as active as it used to be.)
I didn't see this in the archives but I was curious if any consideration has been given for standardizing on features more commonly found in most other language's standard library.
For example reading and writing to sockets in JavaScript requires platform specific libraries and works very differently between them. The same goes for file io (which would obviously need restrictions when run in, say, a web browser).
Building these in would make JavaScript more universal and easier to learn (you learn one way to access a resource instead of 2 or 3 very different ways).
I would be happy to work on a proposal for such changes if they were desired by the community. Thoughts?