5 ms·
I wish MS will fork Typescript into a new language altogether that transpiles to JS or compiles to WASM. In that case, they can remove all JS weirdness from it
by prmph 4y ago
I wish MS will fork Typescript into a new language altogether that transpiles to JS or compiles to WASM.
In that case, they can remove all JS weirdness from it, simplify it, add a proper standard library, and add other good parts from other (especially functional) languages to it.
My wish list for such a language (in addition to what is already in Typescript), in no particular order:
- Generic object literals (Why should generic type inference be limited to functions?)
- Deep support for an alternative to exceptions using a Failable<TResult, TError> type
- Localizable keywords (Why should programming languages be tools of cultural hegemony?)
- Dependent types, with no real distinction between values and types (At a certain point, Typescript’s type system begins to look like a separate Turing-complete language within a language. It’s probably time to do away with this dichotomy entirely somehow)
- Higher-kinded types (This is a pending issue in TS since 2014)
- JSX built-in without the need for any React-like dependency (No need to use it if you don’t like it; in the general sense, it’s just syntactic sugar for composing function invocations)
- No return necessary (the last expression in a block is returned). Thus every flow control construct _can_ (but does not have to) be an expression.
- No null, undefined, or any of all that, in favor of using a Maybe<T> type
- Proper decimal types (it’s shameful for a language to be without it now)
- A reasonably extensive standard library (Math, Stats, Collections (pull & push), String, Objects, Date/Time, Async, Functional, DOM, etc.)
That would be getting close to the perfect language for me.
- dmix 4y ago> Deep support for an alternative to exceptions using a Failable<TResult, TError> type Is there a good library for this currently? I've been looking for one and a Maybe library. The Maybe one I use is pretty small.
- halfmatthalfcat 4y agofp-ts (and most functional libraries) have a handy Either type just for this: https://gcanti.github.io/fp-ts/modules/Either.ts.html https://gcanti.github.io/fp-ts/modules/Either.ts.html
- dmix 4y agoThat looks perfect thank you.
- modeless 4y agoIf you're breaking backwards compatibility then my number one request is replacing UTF-16 with UTF-8 for strings and nothing else comes close.
- yencabulator 4y agoYou're asking Microsoft to undo a very Microsoft oddity that Microsoft seems to use just about everywhere. Good luck!
- lmm 4y ago> In that case, they can remove all JS weirdness from it, simplify it, add a proper standard library, and add other good parts from other (especially functional) languages to it. Have you tried Scala.js? It's pretty much what you're asking for - a first-class functional language with all the things you'd expect from that, with compile-to-JS as something that works and feels fully first-class (and good integration with TypeScript types via ScalablyTyped).
- prmph 4y agoScala.js seems interesting, and I will look into it more. But if it is so nice, why hasn't it taken off like TypeScript?
- lmm 4y agoScala was traditionally a backend language (and has a bit of an image problem, and some genuine community politics troubles), and isn't so well known on the front end side. I do believe it's genuinely the best language going though.
- matt_kantor 4y agoI think a big part of TypeScript's success is because it's just "JavaScript with types".