Re:TypeScript Is Surprisingly OK for Compilers
by jitl on Friday August 18, 2023 @07:41AM
(#37174331)
Go has exceptions: you can use `panic` to throw/catch just fine. The community will bring out the torch and pitchforks because it’s “not idiomatic” but if you’re programming solo or with other pragmatists don’t let it stop you.
Re:TypeScript Is Surprisingly OK for Compilers
by madeofpalk on Friday August 18, 2023 @11:41AM
(#37177187)
Or just pass pointers because you need optionality, and get null pointer exceptions for free :)
Re:TypeScript Is Surprisingly OK for Compilers
by skybrian on Friday August 18, 2023 @01:02PM
(#37178627)
Does the community care if it’s not in a public API? If it’s caught within the same library it doesn’t affect anyone else.
Re:TypeScript Is Surprisingly OK for Compilers
by andrewcobby on Friday August 18, 2023 @09:55AM
(#37175661)
I’m actually working on a language like this. I quite liked ReScript/ReasonML, but having to manually write binding to use TypeScript or JS code is a drag. I’m making a functional language that looks and feels like TS and lets you import TS directly. Mostly just stripping imperative statements, removing class declaration and adding pattern matching and better data constructors (never liked the discriminated unions). WASM as a target is a bit further off.
My fantasy for the past year has been, if I could magically program anything, bringing a compiler and spec wholesale into the world out of the void, I would create a new language (call it WebScript as a placeholder) that
- featured an ML style type system, ADTs, a type syntax nearly indistinguishable from TypeScript
- whose actual core language essentially resembled Kotlin or "Go with exceptions"
- compiled to WASM or JS as a compatibility bridge
Nothing radical. Nothing revolutionary. Just these things would be an immediate plus.
But maybe AssemblyScript is a good enough step towards that.