News for hackers. Stuff that matters.
Re:Are dynamic languages going to replace static languages? ... by thaumasiotes on Wednesday August 04, 2021 @04:24AM (#28058598)
> some of what it produces is exactly the "noisy defensive code" you're talking about, for the simple reason that it's an elegant language that has to compile down to a worthless untyped jargon like javascript.

I don't understand. All languages, without exception, must compile down to a "worthless untyped jargon". Only assembly can execute.

Re:Are dynamic languages going to replace static languages? ... by noduerme on Wednesday August 04, 2021 @06:48AM (#28059493)
I miscommunicated that, slightly. What I meant was that you still have to write defensive type checking code in Typescript, because it's only decoration, and you can't rely on the underlying JS to throw type errors either at compile time or runtime.

Javascript is a garbage layer of broken standards, a worst of breed language that shouldn't have to exist between a strict typed higher level language and lower level bytecode, but everything on the web now needs to be built on top of it, compile to it first, and run through one of a few JS engines. You can never build a full fledged language on top of something that has to go through JS... so TS, coffescript, et al are always going to be pseudo typed but not truly solid or permanent solutions.

Ultimately I think ECMA standards will finally move toward strict types in JS, and in a decade more we'll have something that for all intents and purposes is exactly what Flash was in 2009.

Re:Are dynamic languages going to replace static languages? ... by Zababa on Wednesday August 04, 2021 @10:50AM (#28061656)
> you can't rely on the underlying JS to throw type errors either at compile time or runtime.

Sure, but if your typed language is sound you shouldn't have type errors at runtime. Not having type at runtime is not a problem, type erasure is nothing new and works really well in OCaml.

> You can never build a full fledged language on top of something that has to go through JS... so TS, coffescript, et al are always going to be pseudo typed but not truly solid or permanent solutions.

Rescript and Elm are really solid, OCaml can compile to JS too, Scala and F# too. Granted, only Elm has been built on JS at first, others were adapted (Rescript is like half and half), but they're all solid.

> Ultimately I think ECMA standards will finally move toward strict types in JS, and in a decade more we'll have something that for all intents and purposes is exactly what Flash was in 2009.

I think the idea here is to offer WASM as a compilation target. Trying to gradually type JS leads to really complex systems (TS types) because people did all sorts of crazy things with JS. I wouldn't like this to be the base on which we build other languages, or the web in general.

Re:Are dynamic languages going to replace static languages? ... by cutler on Wednesday August 04, 2021 @07:48AM (#28059854)
Clojurescript gives you a lot more than TS but with different trade-offs. I'll take immutability, a real REPL, clojure.spec and 600 functions over static types any day.
Re:Are dynamic languages going to replace static languages? ... by throw868788 on Thursday August 05, 2021 @03:51AM (#28071002)
Why not both? Seen that work quite well.
Re:Are dynamic languages going to replace static languages? ... by skohan on Wednesday August 04, 2021 @04:47AM (#28058732)
At the risk of being pedantic, only machine code can execute.