News for hackers. Stuff that matters.
Re:Deno 1.9 by paxys on Tuesday April 13, 2021 @04:56PM (#26799184)
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?

Re:Deno 1.9 by brundolf on Tuesday April 13, 2021 @05:12PM (#26799388)
JavaScript 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.

Re:Deno 1.9 by girvo on Wednesday April 14, 2021 @01:29AM (#26803258)
Part 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!
Re:Deno 1.9 by brundolf on Wednesday April 14, 2021 @11:22AM (#26808365)
CommonJS 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.

Re:Deno 1.9 by bijection on Tuesday April 13, 2021 @05:06PM (#26799319)
You 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.

Re:Deno 1.9 by the_duke on Tuesday April 13, 2021 @05:40PM (#26799699)
The 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.

Re:Deno 1.9 by halfmatthalfcat on Tuesday April 13, 2021 @05:57PM (#26799872)
Nope, that’s why there’s a million node-fetch, isomorphic-fetch, etc variants
Re:Deno 1.9 by maga on Tuesday April 13, 2021 @05:15PM (#26799421)
Indeed. 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.

Re:Deno 1.9 by eyelidlessness on Tuesday April 13, 2021 @09:06PM (#26801795)
Overall 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.

Re:Deno 1.9 by folkrav on Tuesday April 13, 2021 @10:24PM (#26802267)
> 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.

Re:Deno 1.9 by lobstrosity420 on Tuesday April 13, 2021 @10:42PM (#26802352)
>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.

To be fair, decorators are an experimental feature in name only at this point. A lot of libraries force you to use it, including Microsoft's own tsyringe and the beyond popular TypeORM. NestJS is a reasonably popular framework that will codegen services with decorators in them. As the OP of this thread said, the toothpaste is out of the tube now.

Re:Deno 1.9 by folkrav on Tuesday April 13, 2021 @10:43PM (#26802365)
Fair point.
Re:Deno 1.9 by lygaret on Wednesday April 14, 2021 @02:18AM (#26803571)
the entire angular2+ ecosystem as well
Re:Deno 1.9 by tengbretson on Wednesday April 14, 2021 @10:50AM (#26807887)
> Hmm, what did I miss, why do people hate them exactly?

They operate in a weird gray-zone between being just compile-time types vs. an actual readonly object in the runtime. I don't think I've seen a use case for them yet that wouldn't have been better accomplished with a union type of string literals and using const string literals in the code.

Re:Deno 1.9 by folkrav on Friday April 16, 2021 @12:05PM (#26835627)
Say all you need is a fixed set of strings that get reused everywhere. What is better accomplished by defining a union type AND consts literals rather vs creating a single string-based enum and using that everywhere? I feel like I'm misunderstanding...
Re:Deno 1.9 by mssundaram on Thursday April 22, 2021 @01:23AM (#26899052)
You don't even need the const literals.

    type Color = "red" | "blue" | "green";
Re:Deno 1.9 by pierreyoda on Wednesday April 14, 2021 @04:19AM (#26804380)
> Hmm, what did I miss, why do people hate them exactly?

In my experience, enums are far less type safe and convenient (usage in switch for instance, combined with a linter) than union types.

Re:Deno 1.9 by flyingchipmann on Wednesday April 14, 2021 @11:26AM (#26808414)
The thing is enum and union type have different use cases. Union type cannot be used to check against incoming data. It's a lightweight type level feature. There is no way for compiler to identify the unknown data object from the network. Enum is essentially an object in memory which can be used in this case.
Re:Deno 1.9 by hayd on Tuesday April 13, 2021 @05:35PM (#26799624)
There's the web APIs which are tested against 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?

Re:Deno 1.9 by tracker1 on Monday April 19, 2021 @03:14PM (#26866801)
Because 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.
Re:Deno 1.9 by dwaite on Wednesday April 14, 2021 @12:40PM (#26809544)
There 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.