9 ms·
I hear so much good stuff about Elixir and Phoenix (often from fly.io blogs) but I've always dismissed it for the lack of type support. Is there a TypeScript eq
by crummy 3y ago
I hear so much good stuff about Elixir and Phoenix (often from fly.io blogs) but I've always dismissed it for the lack of type support. Is there a TypeScript equivalent on the horizon? Or is it not so much of an issue?
- satvikpendem 3y agoThe Gleam language is the alternative, it also runs on BEAM. It's also supported by Fly.io as is this article. It was also recently discussed [1]. [0] https://gleam.run/ https://gleam.run/ [1] https://news.ycombinator.com/item?id=38031342 https://news.ycombinator.com/item?id=38031342
- winter_blue 3y agoI second this question. Static typing is super critical for large projects.
- lawik 3y agoI hear this a lot. I get that it is helpful. But I know people run large projects without it in Elixir and seem to do fine. Discord and remote.com seem likely to be fairly massive. Last I spoke to Remote they did 70 releases a day and no type static typing. I know from Elm that it does change how things feel. I could see an upside. But coming from a dynamic life I can't quite grok considering it a requirement.
- sodapopcan 3y agoNot to mention the AXD301 :)
- gloryjulio 3y ago> fairly massive It really depends on your definition of your massive. Discord seems to have a few hundreds to a thousand employees in total. I am from a typical tech company. So I could estimate that their total engineers count is probably just a couple of hundreds, which is about our director/senior director's team size. In our definition of massive, we could have even hundreds of ppl to touch the same portion of the code base frequently. We regularly have to deal with code which are about 10 years old and it's a moving target. You have to deliver quickly with migration requirement in mind. Also we frequently collaborate with the other teams and you have to be able to understand others' code quickly. Typing is critical as you don't have time to deal with the constant stream of the new projects to dig deeper in to the objects. And you really want to have some understanding of the code in the first glance. We also want to offload lots of the things to compiler and ide as much as possible. It doesn't have to be full on static typing like Java, type annotation in python/ruby already helped a lot
- peoplefromibiza 3y ago> It really depends on your definition of your massive massive as in the top 10% of tech companies in the entire globe > Discord seems to have a few hundreds to a thousand employees in total quote: WhatsApp scaled to 1B users with only 50 engineers [1] https://news.ycombinator.com/item?id=28985169 https://news.ycombinator.com/item?id=28985169
- gloryjulio 3y ago> massive as in the top 10% of tech companies in the entire globe But are you talking about the size or the impact of the project? I am in the fintech space and the complexity and cruft is just incredible thick. We just needs so many ppl to do the dirty work. There is no way for you to shrink the code base fundamentally > quote: WhatsApp scaled to 1B users with only 50 engineers [1] Again, are we talking about the size or the impact? Are you saying all the projects for in faang can be handled like this? Meta currently have about 70k engineers. What do you think that all those people are doing?
- peoplefromibiza 3y ago> What do you think that all those people are doing? justifying the salary of middle managers. at my current job the number of employees has increased 30x in just 5 years. there's no important single task we couldn't do when we were 1/30th of now, 2.5x would have been the perfect number to make all of us work no more than 3 days/week, now we are just working on more tasks that are basically DOA or scratch the itches of higher ups who want their name on something when they meet with other higher ups but are useless. Moreover, more often than not, they are a minor variation of something that already existed for a long time, works better, serves a real business purpose and it's written in legacy languages because it just works (I'm sure many of us have attended the and now with AI! BS meeting). We also know Facebook's 70k employees are there so that many of them won't end up working somewhere else and help the competition (see the Silicon Valley No-poaching Case). I'm an advocate for not burning up your employees and hire more than you need so everyone can relax, I'm a union representative (on of the) in the company I work for (yes, my country is highly unionized and thanks god it is) so I deeply support the needs of the workers against the absurd demands of the companies, but at some point too many people becomes a burden and severely hinders communication, it basically creates a layers of bureaucracy that resembles much more politics than the job you were hired for, ending up stressing people more, creating harmful frictions, complicated workflows, absurd chains of indirection and countless authorization requests that in the end reduce everyone's output, regardless of the commitment of the single employee. Also, larger companies get a lot more slack taxation wise and receives a lot more cuts from the government, because unemployment makes us look bad.
- peoplefromibiza 3y ago> Static typing is super critical for large projects YMMV very large project have been written in Erlang/Elixir without static typing and they've been wildly successfull i.e WhatsApp (based on Ejabberd), Ericsson network switches, RabbitMQ, CouchDB and a lot more, you can read about some of them here https://www.erlang-solutions.com/blog/which-companies-are-using-erlang-and-why-mytopdogstatus/ https://www.erlang-solutions.com/blog/which-companies-are-us... as a less knows example, an entire insurance company in my country with > 1 million customers
- cschmatzler 3y agoElixir will get type support, it left the research stage and is now in development.
- sodapopcan 3y agoIt might get type support. They have been very upfront that they might fail and will only proceed with it if they can come up with something that is right for the language. It's not a rush to get a type system just to attract more users. I'm very optimistic they'll succeed, though! :)
- mrmincent 3y agoIt’s underway - https://elixir-lang.org/blog/2023/09/20/strong-arrows-gradual-typing/ https://elixir-lang.org/blog/2023/09/20/strong-arrows-gradua...
- chromatin 3y agoGREAT NEWS! This is what has kept me away from Elixir, but no such great web framework yet exists for e.g. Rust
- Yoric 3y agoEh. I designed some kind of static type system for Erlang ~20 years ago. It wasn't very good and I changed job before I could test it on anything serious, but it was fun! Glad to see that some people are doing a more serious job than me :) (also, it's a small world – I know Giuseppe Castagna, wasn't aware that he was working on typing Elixir)
- shijie 3y agoThe language is still strongly typed, and with the language being purely functional, I found myself not missing static typing nearly as much as I thought I would. Things just work, and they break during compilation if they don’t. I will say that editor support for static languages is categorically better due to the language server being able to more completely reason about the state of your code. That’s the one drawback.
- loloquwowndueo 3y agoElixir is not strongly typed. You can bind any data type to a variable at any time.
- pitkali 3y agoElixir doesn't technically have variables. Those are bindings: you give names to values. Variable would be more like a box storing a value.
- impulser_ 3y agoThis is not true. For example doing "1" + 2 would give you an error.
- sodapopcan 3y agoYou also can't do "foo" + "bar" to get "foobar", you have to do "foo" <> "bar" giving it even more type "strength" than many strongly typed dynamic languages have.
- arcanemachiner 3y agoDo you know if that was a conscious decision for that reason? I always wondered why that operator was used instead of a + sign.
- sodapopcan 3y ago
- impulser_ 3y agoIt not as big of an issue as people make it out to be. Maybe it becomes they haven't used a functional programming language. I have yet to have a problem with Elixir where static typing would be the only thing that would solve the problem. Elixir has great support for pattern matching, guards, documentation, testing and being a functional language all help negate the problems of a dynamic language.
- thibaut_barrere 3y agoI've done both strongly typed & "less typed" languages over the last couple of decades, and I do not find the current situation a problem in Elixir. We're using Dialyzer on my main project, without too much interest I must say. I am following the discussions on that topic (improving types in Elixir) with interest, but it's not an issue for me at the moment (and large refactorings occur without much troubles either). I think the fact that most functions are "pure" / "static" is really helping with refactorings.
- tryptophan 3y agoElixir has features called guards which allow you to check for a condition to be true before a function is called(and will match another version of the same function if it is false). This is used as a crude form of type checking.
- cpursley 3y agoI don’t find guards “crude”, they’re actually quite elegant. At least coming from the Ruby world.
- sodapopcan 3y agoThey were saying guards are a crude form of type-checking, not intrinsically crude. Really they are a perfectly regular form of type hinting--as is pattern matching in function heads--when being used for no other purpose than to ensure the correct type is passed at runtime.
- keep_reading 3y agoUse this until the one built into the language is ready. It has incredibly low performance impact too. https://github.com/Qqwy/elixir-type_check https://github.com/Qqwy/elixir-type_check
- AlchemistCamp 3y agoI’ve been using Elixir for most of the past six years and really haven’t ever been bitten by the type system. I’m fairly sure that pattern matching , structs and immutability is why. This topic has come up quite a few times on HN, but it seems like it’s generally people who haven’t ever used Clojure or another similar immutable functional language that worry about this. IMO, Elixir and Clojure hit the sweet spot between a language like Ruby and one with an ML-inspired type system.