Earlier quoted context omitted.
That's some very high level view - in reality even tough those languages are in similar categories the experience would be vastly different : TypeScript - powerful type system but shit underlying stdlib and language (no pattern matching/switch expressions) Dart - worse than TS because the object model is closed - so no dynamic freedom, but the type system and expressions are weaker then the rest. Also 0 meta programm…
If you’re going to use C# for a compiler, why not go the whole hog & use F#?
TypeScript is surprisingly ok for compilers
141–150 of 245 posts
Re: TypeScript is surprisingly ok for compilers
#142Earlier quoted context omitted.
There's an answer from TypeScript team for your question :) https://twitter.com/drosenwasser/status/1260723846534979584 Basically, > Let's say TypeScript takes over 20 seconds to type-check a medium-sized program. That's not usually because it's JS, it's often because of types that cause a combinatorial explosion. Also > A different runtime can afford a lot (it sounds like parallelism and start-up time in this case)…
I mean I get what Daniel's saying, but I kinda doubt there wouldn't be _some_ speedup. And hey, what if type checking for small programs went from half a second to 100 ms? That would be nice!
Re: TypeScript is surprisingly ok for compilers
#143Very much apropos: Going between Rust and TS it is painfully obvious how much sth like tagged enums are missing, which can also be seen in this post. I know of this [1] proposal for ADT enums which looks like it has stalled. Anyone know of other efforts? [1] https://github.com/Jack-Works/proposal-enum/discussions/19
Re: TypeScript is surprisingly ok for compilers
#144TypeScript is an incredible language in general. The fact that Functions are Objects that can have properties/methods is supremely undervalued. Are there other languages that do this so nicely? It's the perfect blend of OO and functional. Programming is mostly about gradually figuring out the right design I find. JS/TS let's me evolve things naturally without big rewrites. function foo() {} function bar() {} function…
>>> Are there other languages that do this so nicely? It's the perfect blend of OO and functional. Python, where everything is an object.
Example, I have some Redux helpers that are functions, but those functions also define a `.actionType` property. TypeScript handles that.
edit: accidentally wrote "object" instead of "function"
Re: TypeScript is surprisingly ok for compilers
#145Earlier quoted context omitted.
I actually argue JS was a better language before all of the changes made, starting with const/let. The only thing I'd say makes sense are classes but the fact they aren't syntax sugar over prototypes was a mistake. People wanted a different language, they should have gotten more scripting languages in the browser. Not changing JavaScript so much that it's no longer JavaScript.
> aren't syntax sugar They aren't syntactic sugar? Pretty sure `class Foo { blah() {} }` is equivalent to `function Foo() {}; Foo.prototype.blah = function() {}`.
Re: TypeScript is surprisingly ok for compilers
#146Is that really suprising? Typescript is yet another language that has, kicking and screaming, picked up most of the ML featureset. I'd expect it to be, well, fine; the lack of real pattern matching is a pain, so it's going to be inferior to OCaml, but fine, no different from using C# or Swift or Dart or Kotlin or something of that ilk.
Re: TypeScript is surprisingly ok for compilers
#147Earlier quoted context omitted.
> IMHO typescript could just cut loose from its javascript compatibility. Why not compile it to wasm instead of transpiling it to javascript? 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 n…
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
#148Earlier quoted context omitted.
I never ever use try/catch in my code. The only time its really necessary is to wrap JSON.parse on use of untrusted input. For everything else it just feels sloppy as through there is insufficient logic in place for handling primary conditions versus edge cases. Also, try/catch will never compile in the JIT.
> Also, try/catch will never compile in the JIT Changing the way you program to fit what a JS compiler does or doesn't do is a fool's errand, IMO. The performance benefits are likely to be minimal, confusion for anyone else who has to touch the codebase is high.
Much better to just write ideomatic code.
Re: TypeScript is surprisingly ok for compilers
#149TypeScript is an incredible language in general. The fact that Functions are Objects that can have properties/methods is supremely undervalued. Are there other languages that do this so nicely? It's the perfect blend of OO and functional. Programming is mostly about gradually figuring out the right design I find. JS/TS let's me evolve things naturally without big rewrites. function foo() {} function bar() {} function…
What does TypeScript add in this scenario?
Does the example above even pass typecheck?
Re: TypeScript is surprisingly ok for compilers
#150Earlier quoted context omitted.
> This is why once WebAssembly more polished and more common, languages like JS and TS could become obsolete since proper, more powerful languages will suddenly become a valid choice for Web. JavaScript and TypeScript are not "proper" languages? Different languages are powerful in different use case dimensions (tradeoffs), and the typical client-side web programming has a very very strong UI angle, which many "more p…
JavaScript's redeeming quality is that it is ubiquitous due to being used by browsers. I don't think anybody credibly claims it to be a language we would want to use if we were to redesign web programming from scratch today