4 ms·
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
by enlyth 4y ago
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.
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.
- lioeters 4y agoI suppose AssemblyScript fits some of those points: no any or unknown; compiles to a binary; GC; cross-platform.
- math_dandy 4y agoHow about F#?
- tlrobinson 4y agoIt sounds like you want “deno compile” (https://deno.land/manual@v1.25.4/tools/compiler https://deno.land/manual@v1.25.4/tools/compiler) plus “no-explicit-any” eslint rule (https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-explicit-any.md 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?
- yencabulator 4y agoThat 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.
- d3nj4l 4y agoYou want C# with dotnet AOT.
- zoom6628 4y agoYou beat me to it. Exactly this - use C#.
- cjonas 4y agoLast I checked C# didn't have an algebraic type system...
- Smaug123 4y agoBut F# is sitting in the corner with an eyebrow cocked suggestively.
- TDiblik 4y agoC# 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.
- zarzavat 4y agoThere’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.
- graftak 4y agoAbout 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>>.
- zozbot234 4y ago> 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?