Re:Show HN: Ezno, a type checker for JavaScript and optimise...
by tlrobinson on Friday September 23, 2022 @07:40PM
(#32958361)
It sounds like you want “deno compile” (https://deno.land/[email protected]/tools/compiler) plus “no-explicit-any” eslint rule (https://github.com/typescript-eslint/typescript-eslint/blob/...).
Or are you wanting a language with different semantics that could be compiled to actual machine code?
Re:Show HN: Ezno, a type checker for JavaScript and optimise...
by yencabulator on Thursday September 29, 2022 @05:29PM
(#33027481)
That still allows `x as string` and many other traps. Typescript just isn't type-safe, and this has bitten me so many times in real world projects with strict mode and all. The best thing I can say about Typescript is that it's an improvement over Javascript.
Re:Show HN: Ezno, a type checker for JavaScript and optimise...
by d3nj4l on Friday September 23, 2022 @07:51PM
(#32958438)
You want C# with dotnet AOT.
Re:Show HN: Ezno, a type checker for JavaScript and optimise...
by zoom6628 on Friday September 23, 2022 @09:20PM
(#32958947)
You beat me to it. Exactly this - use C#.
Re:Show HN: Ezno, a type checker for JavaScript and optimise...
by cjonas on Friday September 23, 2022 @11:55PM
(#32959621)
Last I checked C# didn't have an algebraic type system...
Re:Show HN: Ezno, a type checker for JavaScript and optimise...
by Smaug123 on Saturday September 24, 2022 @05:12AM
(#32960941)
But F# is sitting in the corner with an eyebrow cocked suggestively.
Re:Show HN: Ezno, a type checker for JavaScript and optimise...
by TDiblik on Sunday September 25, 2022 @03:46AM
(#32969656)
C# does not have "type" keyword and really lacks behind with enums. You can theoretically replace algebraic type system with inheritance, however that's a lot of times ugly and you propablly shouldn't do it.
Re:Show HN: Ezno, a type checker for JavaScript and optimise...
by lioeters on Friday September 23, 2022 @06:10PM
(#32957700)
I suppose AssemblyScript fits some of those points: no any or unknown; compiles to a binary; GC; cross-platform.
Re:Show HN: Ezno, a type checker for JavaScript and optimise...
by zozbot234 on Saturday September 24, 2022 @04:49AM
(#32960837)
> I wish Microsoft would make a language almost exactly like Typescript, but where code has to be strictly typed (no any, unknown, etc.) and it would compile to a normal binary, with some sort of GC, for multiple platforms.
Isn't that what ReasonML is for?
Re:Show HN: Ezno, a type checker for JavaScript and optimise...
by zarzavat on Saturday September 24, 2022 @02:11AM
(#32960084)
There’s no such thing as “fully sound” type system, outside theorem provers like Lean. Every type system has a trapdoor. Rust has “unsafe”. Haskell has “unsafePerformIO”. And TypeScript has “any”. Soundness is just as much a property of a language’s culture as its implementation. Practically I find that TypeScript is sound enough for my purposes when most of the strictness options are enabled.
Re:Show HN: Ezno, a type checker for JavaScript and optimise...
by graftak on Saturday September 24, 2022 @03:34AM
(#32960464)
About 90% of any can and should be replaced with unknown which is infinitely more useful and a lot safer.
There is an example signature at the end of the article; (x: any) => string, this error would not fly if x were unknown.
On of the few remaining scenarios where any might be necessary is to narrow down a generic param, ie <T extends Something<any>>.
Re:Show HN: Ezno, a type checker for JavaScript and optimise...
by math_dandy on Friday September 23, 2022 @06:54PM
(#32958030)
How about F#?
It would hit the sweet spot for me, I know Rust is popular these days, but it seems like it's made for type astronauts, and sometimes I just want to write some code and get things done quickly and don't care about squeezing out every last drop of bare metal performance or abstracting seven layers of types to please a borrow checker.