8 ms·
TypeScript won. I was watching this video by Evan Czaplicki the creator [0], and what struck me was that back then, Evan was absolutely right. He was right that
by satvikpendem 4y ago
TypeScript won. I was watching this video by Evan Czaplicki the creator [0], and what struck me was that back then, Evan was absolutely right. He was right that in the high level, we needed a typed JS, but he was wrong in the lower level details, at least in terms of market share. TypeScript won precisely because it doesn't start off as intimidating for JS users, while others like Reason and Elm died off, but ironically TS is way more complex than either of the others in its type system.
Another factor for this is that Syntax Matters™. When Gleam (language on the Erland runtime, cousin of Elixir) started out, it had a Haskell-like syntax, but this was found to be a barrier for adoption, so when the creator changed it to be more C and Rust-like, the adoption rate picked up significantly [1]. In the same vein, perhaps Elm was just too esoteric for those coming from JS. I strongly believe the reason Rust became so popular is that it's an ML in C clothing, rather than being a pure ML like OCaml. With curly braces and all, it's more accessible and then people start learning about the more functional features like maps, folds, and so on.
Elm also had quite a rocky history with the BDFL not allowing other people to use the features the compiler maintainers could use, such as escape hatches, which are documented in other parts of HN. This article [2] is a particularly good overview of why some people left.
[0] https://www.youtube.com/watch?v=oYk8CKH7OhE https://www.youtube.com/watch?v=oYk8CKH7OhE
[1] https://news.ycombinator.com/item?id=22902462#22903210 https://news.ycombinator.com/item?id=22902462#22903210
[2] https://news.ycombinator.com/item?id=22821447 https://news.ycombinator.com/item?id=22821447
- jokethrowaway 4y agoTypescript didn't win anything and its type system doesn't deliver nowhere close to elm s value. Elm was simply to risky given how quickly the maintainers fenced off native access.
- nsonha 4y agoAnd elm delivers what? Some people writing some apps that they claimed to have less bugs and are easier to maintain? Who uses these apps? Who can tell? It’s all hearsay.
- jayshua 4y agoI maintain a 50,000 line elm app. It's not the most used app in the world - has between 50-100 users. But it has had a sum total of 2 bugs since launch - both logic bugs in some complex financial projections. Contrast with an elixir app of similar size that I also maintain. I fix on average 1-2 bugs per week, almost all of them are things that the elm compiler would have prevented like calling a function that was removed or renamed last month or not handling a case where a database request returned 0 records instead of 1. Honestly though the biggest draw for me is the refactoring experience. For various reasons I had to do a major refactor of both code-bases. Not adding new features or anything, just restructuring the code and module layout to line up with the way the code actually functioned. Paying the tech debt essentially. I'd say both refactors were of roughly similar complexity, touching probably 75% of the files in each project. The elm refactor took about 5 hours and worked as soon as I fixed all the compiler errors. I never had to fix a bug from that refactor - it just worked. And the code was way easier to understand after paying all that tech debt back. The elixir refactor took 4 days, full time. 25ish hours. It also required me to write about 150 tests that weren't there before because the compiler wasn't able to point out code that would always fail at runtime. After deployment I had to fix a handful of bugs that still made it into production, despite how careful I was to not break anything. Idk, being able to completely restructure the code without worrying about breaking anything really appeals to me for some reason.
- satvikpendem 4y agoYour argument is more about static versus dynamic typing rather than anything Elm specific, as you can get all of that with TypeScript too, but without opting into Elm's entire framework. One reason why, in my opinion, TypeScript won, as I mentioned above, because it lets you do what you need to do without arbitrary restrictions by the compiler authors.
- jayshua 4y agoMy experience has been due to the type system, I agree. (Also the compiler enforced semver.) I've never had the opportunity to use type script, so maybe it does offer similar benefits to Elm in that area. That's extent my personal experience can push things as far as active production applications go, but it seems to me there's something a bit more in Elm beyond just the type system. Haskell and PureScript both have static typing, but I've had runtime errors in both those languages. Not as often as JS or C or even Rust, but they do happen. In Haskell because the 'error' function exists and so people use it. In PureScript because it has its version of Elm's native modules, permitting arbitrary functions to be implemented in JS. The JS can (and does) produce runtime exceptions. It seems to me that the promise from TS, Haskell, PureScript, etc. is something like "with this language/type system runtime errors will rarely happen" whereas the promise from Elm is "with this language/type system runtime errors can never happen." I think that transition from 'rarely' to 'never' has been a big part of the Elm project for a long time. It's been on their homepage for as long as I can remember. At least prior to the big 0.18 native modules controversy. If the idea is "no runtime exceptions can ever happen" with the implicit addendum "no matter what you do" native modules have to go. They were a vector by which user code could crash the application, breaking the promise. In that sense the restrictions are not arbitrary, but instrumental in upholding a major design goal of the Elm project. That said, I don't know how much value there is in the "can never crash" promise. It feels like a step in the right direction, but at the same time it seems all the benefits in production code that I've personally experienced and cited in my earlier comment don't fall under the edge cases Elm prevents with its stricter promise. The two or three exceptions I've encountered in PureScript as a result of its version of native modules existing were all in toy programs, so maybe it's just not a big deal in real production apps.
- satvikpendem 4y agoIt won user market-share which is what OP's post is about. TS is not "dead" like Elm is, quite the opposite.
- jupp0r 4y agoThey were never competing with each other and serve completely different use cases.
- tomrod 4y agoLike what?
- jupp0r 4y agoOne is an imperative gradual opt-in superset of JavaScript, the other is a strictly typed functional programming language with a fairly opinionated runtime.
- tomrod 4y agoThis defines what they are, but not what use cases they serve. From what I see of the comments and understanding of both TS and Elm, they have use case overlaps.
- jupp0r 4y agoA hammer and an axe have use case overlaps too. Just because you can build front end apps with both doesn't mean that they serve similar use cases. Elm is more of a framework.
- satvikpendem 4y agoAre both not used for frontend engineering by compiling to Javascript?
- sebzim4500 4y agoTypescript definitely won something. Just looks at the current usage of both languages.
- Hermitian909 4y ago> Reason and Elm died off I'm still quite sad that Reason died. The syntax was much more comfortable and familiar than OCaml's while still delivering a ton of power. Have an optimizing compiler run on your JS was actually quite helpful. As a bonus you could have your backend running either Node or OCaml depending on your needs (ecosystem vs perf). Was really unfortunate when the drama around Reason the language vs the Bucklescript compiler blew up and resulted in ReScript (a language that appealed to approximately no one in the existing user base).
- satvikpendem 4y agoYes it really was nice. I thought Reason could give Rust a run for its money as something similarly ML-like but without the manual memory management via the borrow checker. But sadly the Reason and OCaml ecosystem is still very much fragmented, there is nothing like what cargo does (entirely, not piece-wise) in the OCaml space.
- yawaramin 4y agoReason didn't exactly 'die', the toolchain that most people used to call 'Reason' just rebranded as ReScript. And no, you could not have your backend running either Node or native OCaml (I assume you mean binary executable), no one ever made a viable library or framework to do that. Sure, it was theoretically possible if you did a ton of work, but no one did that, because it would have been a huge amount of work (seriously, a lot).
- Hermitian909 4y agoHi Yawaramin, I remember you fondly from the discord and hope you're well. > Sure, it was theoretically possible if you did a ton of work, but no one did that, because it would have been a huge amount of work (seriously, a lot). I think I communicated unclearly. It sounds like you read my statement as "run the exact same code in node or OCaml" which I agree would have been very hard. I had a much simpler multi-service setup where I could share some business logic. Basically I had two services with the code unique to them stored in different directories, /ocaml-server and /node-server respectively. Both called into a common /lib directory. /ocaml-server had some very hot loops in it, /node-server had more standard business-y code that hooked into various npm packages. > 'Reason' just rebranded as ReScript Between the breaking changes and the general change in development philosophy (not really caring about OCaml server side) I felt it was a completely different language. Certainly switching to the ReScript compiler for my project would have required nearly a complete rewrite.
- bmitc 4y agoIt's rather unbelievable to me that people find ML syntax unfamiliar and off-putting. It makes no sense, and I have always found it disappointing that both Rust and Gleam moved away from it. People seem to love Python syntax. ML syntax is just more regular, consistent, and typed. How is that worse?
- ghqst 4y agoIt's a matter of personal preference, and there's a lot more people who are familiar with C-style syntax. A good amount of those people also dislike Python, in fact.
- tooltower 4y agoFamiliarity. The preferred syntax is the one that incurs the least cognitive load. Which in turn depends on what they are already familiar with.
- dom96 4y agoIt makes perfect sense. Most programmers learn to program on a C-like, Basic-like or Python-like language. Not ML-like. What's familiar is what's easiest to adopt.
- bmitc 4y agoBut those languages weren't familiar to begin with. It's like people are saying programmers can only learn to program one time.
- acheron 4y agoGiven how much effort has been spent in shoving Javascript into places it doesn't belong solely so that programmers don't have to learn something else, that seems to be more true than not.
- satvikpendem 4y agoNo, but that's what most people learned, so most people will continue to favor more C-like languages than languages that are not C-like. If you want people to favor ML-like languages, you'd have to start off teaching them ML first (which some colleges do). Industry-wise as well, C-like langs have network effects through the past 30 years, especially in JS land which is a lot of the professional software engineering work done these days.
- 88913527 4y agoIf syntax matters, JSX/TSX will forever reign supreme to DSL's like Angular's templating syntax and Svelte. Angular didn't even start shipping intellisense until years after they invented their markup, and it wasn't all that good: it would crash and use an appreciable amount of system resources. Language and library authors need to learn to meet people where they're at if they want actual market share. Some amount of change is good, but too much is a non-starter, if your concepts can gracefully inter-op with other tooling developers already use.
- satvikpendem 4y agoAgreed, that's why I don't like using templating languages, TSX is still too good to stop using.
- tacotacotaco 4y agoTypescript won because is doesn’t ask developers to write better code, only that they write more code. As you pointed out, its syntax is familiar enough to be non-threatening to existing devs and its type system is completely optional in so far that I’ve worked with clients whose devs proudly proclaim their project is typescript yet they have _no_ types defined. Not that the type system is good anyway and I’m not even talking about `any`. That’s why it is so frustrating to me. Yes, we need a strong typed language but typescript’s type system is just disappointing, so of course it’s popular. Typescript does make the devs _feel_ like it’s secure and that’s more important. Marketing works.
- 88913527 4y agoEven if you aren't using types in first-party code, you're getting autocomplete and inline docs for all the third-party code, including the standard DOM API's, or NodeJS, or whatever types from your NPM modules. There's value in having that even if you live in a mostly `any`-typed codebase (which is likely more common than anyone's letting on).
- satvikpendem 4y agoWhy is it disappointing? TypeScript's type system, via pseudo-dependent-types, is much more powerful than Elm's, Rust's, Haskell's etc. The only problem is that it's not sound, but JS itself is not sound, so TS can never be.
- satvikpendem 4y agoAnd just to add, the most durable thing that Elm has contributed to the frontend world is TEA, The Elm Architecture, upon which most reactive libraries and frameworks now sit, such as React, Flutter, Vue, Angular etc; UI is a function of State.
- acdha 4y agoDidn’t both of them start around the same time? React released close a year later but it reportedly had been running internally at Facebook for a couple years by then. It’s also a relatively modest extension of decades of prior art so I think it might be more accurate to treat it as a formalization of that practice rather than implying it was foundational.
- satvikpendem 4y agoPerhaps it's a case of convergent evolution, since React similarly has a strong functional influence (immutable tree nodes in the VDOM).
- acdha 4y agoDefinitely - it’s always tricky tracing the history of these things since these ideas are coming out of the same larger pool of experience and convention, and people are understandably prone to identifying an idea with the first place they encountered it, lacking visibility into other pockets of the primordial soup. Looking at the language used to describe it on https://guide.elm-lang.org/architecture/ https://guide.elm-lang.org/architecture/ I’m struck by the resemblance to the message-passing systems which were common in the 90s and 80s due to the influence Smalltalk had in the 70s.
- 5n 4y agoSeems like both of them are inspired by Functional Reactive Programing, so yeah, hard to say Elm was foundational
- wpietri 4y agoIs that the case? I thought Bonér's Reactive Manifesto came out around the same time and was based on early Scala work.
- fulafel 4y agoTypescript won over people who mainly wanted static types I think but not the functional programmers. I think people preferring FP on the frontend are using ClojureScript, PureScript and ReasonML or ReScript now. Eg here's Dark's interesting story going to ReasonML via automatic translation: https://blog.darklang.com/philip2-an-elm-to-reasonml-compiler/ https://blog.darklang.com/philip2-an-elm-to-reasonml-compile... (ClojureScript ecosystem was much bigger than Elm to start with in any case I think)