242
new Date("wtf") (jsdate.wtf)
submitted 2 days ago by [email protected] to c/[email protected]
you are viewing a single comment's thread
view the rest of the comments
[-] [email protected] 11 points 2 days ago

Can we start a new web with a better language/platform already?

[-] [email protected] 5 points 2 days ago

Google tried to do that with Dart, and failed. In fairness Dart 1 was much worse than Dart 2... So maybe that was a good thing because there's no way they'd have been able to improve Dart as much as they have if it was part of the web.

For dates there finally is something better anyway: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal

[-] [email protected] 4 points 1 day ago* (last edited 1 day ago)

Dart is fucking amazing and it compiles to native code, transpiles to JS (with some restrictions on concurrency because of web workers) and also supports WASM.

Really if you want to write async and stream based code Dart is very good

[-] [email protected] 2 points 2 days ago

There's wasm if you need to target browsers.

[-] [email protected] 7 points 1 day ago* (last edited 1 day ago)

Yes and no. Wasm has no "standard library" so if you wanted to use Dates, your wasm would need to have its own implemation bundled for when the user visits the page. Ditto for everything else including string support! As you can imagine having to ship all this basic functionality can bloat the wasm and slow page loads.

You also can't fully escape JS, as the only way wasm can interact with the page & browser are through the JS functions you write and make available to your wasm. I suppose you could take advantage of this to not have to ship your own standard library & use the JS Date implementation, but at that point why not just use JS?

Wasm has strengths but it's not suitable for replacing JS for everyday websites.

[-] [email protected] -2 points 2 days ago

Why? Why not improve JS (e.g. with Temporal), especially given how excellent Typescript is?

[-] [email protected] 10 points 2 days ago
[-] [email protected] -2 points 2 days ago

How? It's easy not to run into the common issues by using TS. What's so bad about it that we should throw away the existing ecosystem?

Please give arguments instead of platitudes.

[-] [email protected] 2 points 1 day ago

You don’t need to use TS to avoid common issues. If you add an empty object to an empty array and expect a meaningful result, the problem sits in front of the keyboard.

[-] [email protected] 5 points 1 day ago

Sure, discipline can prevent some errors. But it's always possible to run into wrong type assumptions, and I'd say type coercion and null/undefined access make up a fairly large percentage of non-logic errors. You can entirely prevent those using Typescript, which is why it's so useful.

Static type analysis is always a good idea if you're writing more than a couple lines. IMO Python is the worst offender with its kwargs etc. - discoverability and testability is just so bad if you're following common Python idioms.

[-] [email protected] 5 points 1 day ago

I wouldn't call typescript excellent, if I did it would be on a very low standard.

[-] [email protected] 0 points 1 day ago

It unquestionably is excellent. Can you name another language in common use with a type system that's close to the expressiveness of Typescript?

[-] [email protected] 3 points 19 hours ago

Let's not get ahead of ourselves. Typescript has a decent type system, but it's hardly state of the art. It's impressive how they've managed to mostly corral JavaScript into something much more sane, but at the end of the day it still suffers greatly from the limitations of JavaScript. They've essentially retrofitted some type theory onto JavaScript to make it possible to express JavaScript nonsense in the type system, but there's plenty of things that would have been designed differently had they been making something from scratch. Not to mention that the type system is unsound by design, which by itself puts it behind languages designed from the ground up to have sound type systems.

There's many, many things missing from the type system, like higher-kinded types, type-driven deriving/codegen, generalized algebraic data types (aka GADTs), type families (and relatedly, associated types), existentially-quantified types, and much more.

this post was submitted on 11 Jul 2025
242 points (98.8% liked)

Programming

21545 readers
326 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 2 years ago
MODERATORS