7 ms·
When Node first released its biggest selling point was being able to reuse web APIs. It also filled in gaps for APIs that weren't standard in browsers. Then bro
by paxys 6y ago
When Node first released its biggest selling point was being able to reuse web APIs. It also filled in gaps for APIs that weren't standard in browsers. Then browsers started to add these APIs, and some of Node's implementations naturally diverged (aka the idiosyncrasies that you mention).
Deno has the advantage that they are starting from a clean slate without the burden of legacy APIs, but how long will that hold for?
- bijection 6y agoYou could argue that the apis in question are more mature now than when Node was first released. Either way, if Deno is one day replaced by something else, say 'Done' to keep the naming convention, that won't refute the use everyone will have gotten out of Deno in the mean time, in the same way that Deno doesn't refute the use everyone has already gotten out of Node.
- brundolf 6y agoJavaScript itself has gone through about a 10-year transition period from a toy language for writing quick scripts to a full-on general-purpose programming language. It didn't even have a module system when Node launched. So I strongly doubt the next 10 years will be anywhere near as tumultuous as the past 10. It's very possible that right now is just a much better time to be establishing a JS runtime.
- girvo 6y agoPart of me almost misses `browserify` -- the heady days of "Node modules are the One True Way", with all the constraints that implied. Got a lot done with it and related tooling back then!
- brundolf 6y agoCommonJS worked well enough for lots of things, and it was neat that it was so simple (no new syntax!) But it had limitations, chiefly that imports/exports were not static. Things got imported at runtime when they got reached, etc. This meant that things like browserify were fudging the semantics in some ways, and it also made it impossible to properly do tree-shaking. The stricter semantics of ES modules are better IMO, despite the pain of transitioning.
- maga 6y agoIndeed. I remember that, I have been using node since the very early days, and switched to it for precisely that reason--that I could use the same language through my web application. Nevertheless, when we did get those modern web API, Node was slow to change or adapt them, although, it's doing its best now. In case of Deno, I hope they just stick to following the standards and changing with them. They might not, I cannot vouch for them. On the other hand, I was also skeptical about TypeScript following ECMAScript. I though at some point they'll get too much into conflict and MS will refuse to follow, but so far I've been proven wrong. And from the looks of it, TS even deprecates stuff that is likely to conflict with upcoming ES versions.
- eyelidlessness 6y agoOverall this is true. And beyond that the TypeScript team is heavily involved in TC39, and quite a lot of TC39 proposals are specifically designed to be enhanced by TS. That said... There are a few longstanding incompatibilities/footguns. And they’re likely to remain due to widespread use, even though most are controversial. Off the top of my head: - access control annotations (`private` which is compile time only vs `#`). I’m on the fence on this one. I prefer the TS syntax, but obviously not the behavior. - Enums. Everyone but me hates them. I use them extensively for personal/internal use but try not to force them on others. - Decorators. This is the big bad ticking time bomb. Last I checked the TC39 proposal has diverged significantly from the TS implementation. And sure it’s marked “experimental” but it’s used a lot and almost guaranteed to be a future conflict. Putting that toothpaste back in the tube is gonna make a lot of people feel a lot of pain.
- folkrav 6y ago> enums [...] everybody but me hates them Hmm, what did I miss, why do people hate them exactly? > And sure it’s marked “experimental” but it’s used a lot and almost guaranteed to be a future conflict. Putting that toothpaste back in the tube is gonna make a lot of people feel a lot of pain. Maybe I'm a bit masochist, but I can't say I feel a lot of compassion for people using experimental features in missing-critical production code.
- hayd 6y agoThere's the web APIs which are tested against https://github.com/web-platform-tests/wpt https://github.com/web-platform-tests/wpt (albeit without full coverage), and there is ffi/plugins - for deno specific things like readFile. I don't know the history of Node... but why would there need to be a diversion?
- tracker1 6y agoBecause CJS's "require" is synchronous and was never implemented IN the browser... Deno is close to standards compliant syntax, so much closer to what's in the browser (TypeScript being a super-set). You can use most JS written for Deno in the browser without having to re-write or create odd shims.
- the_duke 6y agoThe selling point was being able to write server code in Javascript and potentially share code between UI and server. Node never implemented any of the essential browser APIs like XMLHttpRequest or later fetch, localStorage, etc.
- halfmatthalfcat 6y agoNope, that’s why there’s a million node-fetch, isomorphic-fetch, etc variants
- dwaite 6y agoThere is a tremendous amount of overlap between the Web and Node API creators, but there has been push-back and slowness to adapt many of the Web APIs in Node by the same group. For example, the delays in adopting ECMAScript modules in node, or the lack of first-party API for fetch.