| ▲ | Elixir v1.20: Now a gradually typed language(elixir-lang.org) |
| 305 points by cloud8421 2 hours ago | 93 comments |
| |
|
| ▲ | losvedir 8 minutes ago | parent | next [-] |
| Oooh, here we go! As a professional Elixir developer for... 10-ish years now, I've been super excited about types coming. I'm very excited that the beginnings have started to land here. That said, I would love to know how the state of what's in v1.20 compares to un-spec'ed dialyzer. I was under the impression that dyalizer's "success typing" approach (not flagging a function if there are some combination of parameters such that it works, rather than flagging it if some combination of parameters can make it fail) was like what Elixir is doing here, and I haven't found dialyzer terribly useful. |
|
| ▲ | sestep 2 hours ago | parent | prev | next [-] |
| I've seen various posts about Elixir's gradual type system pop up on HN, but haven't been following too closely. Does anyone know whether this particular gradual type system can change the asymptotics of programs vs untyped code? As far as I'm aware, most gradual type systems (e.g. Racket) can make programs run asymptotically slower, although there are some exceptions [1]. [1] https://doi.org/10.1145/3314221.3314627 |
| |
| ▲ | eben-vranken 2 hours ago | parent [-] | | Elixir's gradual type system cannot change the asymptotic complexity of your programs. The design explicitly rules out mechanism that causes slowdowns in other gradual type systems (runtime casts at static/dynamic boundaries) Most gradual type systems insert coercions when values cross the types/untyped boundary (checking every element of a list, wrapping values in typed proxies, etc) but Elixir's team published a "strong arrows" result specifically to achieve soundness without those runtime checks. The bytecode the compiler emits is semantically identical to untyped code. | | |
| ▲ | dnautics 2 hours ago | parent [-] | | i think the design can push people into writing unnecessary matches/guards just to trigger the typechecker. that said, I'm a fan |
|
|
|
| ▲ | keithnz 32 minutes ago | parent | prev | next [-] |
| seems ironic that critics were saying, it needs typing, and all the elixir fans were saying you don't need typing, you don't get bugs related to typing because elixir is somehow magic, now they get typing and it finds bugs for them.... but you said you didn't need that to prevent bugs? But good to see! I spent a bunch of time trying out Elixir a while back, I enjoyed it, but just didn't agree with the lack of types. |
| |
| ▲ | jeremyjh 2 minutes ago | parent | next [-] | | I can’t swear I’ve never seen that claim - but I can’t remember seeing it if I ever did and certainly it would be a tiny minority position. The con arguments are basically “it is nice but has costs, maybe those don’t all get a good return”. It’s possible that position was correct before set-theoretic types were introduced. | |
| ▲ | pdpi 17 minutes ago | parent | prev | next [-] | | > you don't get bugs related to typing because elixir is somehow magic, I've never followed Elixir particularly closely, but what I saw in some Erlang discussions was different. Discourse there was that you need to gracefully handle failure anyhow, so type errors can (should?) just get handled by the failure recovery machinery you're supposed to have anyhow. I disagree with that point of view, but it's much more defensible than "$LANGUAGE is magic". | |
| ▲ | Xeronate 24 minutes ago | parent | prev | next [-] | | It was the same thing with javascript/typescript and python. Sometimes you just have to let people think what they want. | | |
| ▲ | pjmlp 12 minutes ago | parent [-] | | The irony is that dynamic languages that predated them had optional typing. BASIC, Smalltalk vs Strongtalk, Common Lisp, Dylan It is the eternal September. |
| |
| ▲ | zuzululu 17 minutes ago | parent | prev | next [-] | | I think Elixir is interesting and there is real value but some stuff being sold as "all these libs/packages that haven't had any updates for over a year is fine because Elixir" I just don't buy it and to that point around typing feels like the same wish-washy hand waving from the community that is very off putting BEAM has genuine use cases but its not as wide as its made to believe. There are very good places where that is a perfect fit but it simply cannot upend Typescript. Elixir feels very similar to how Clojure started getting traction and then ultimately forgotten apart from its die hard fans, I'm not saying Elixir will go the same way but seems very hard for something new and bold to replace what is popular and boring. I do want Elixir to succeed (also Clojure as well and I advocated for it for a bit) but the low number of jobs still puts it in similar proximity to Clojure but BEAM I think would still provide uplift where Clojure simply could not | | |
| ▲ | josevalim 9 minutes ago | parent [-] | | > some stuff being sold as "all these libs/packages that haven't had any updates for over a year is fine because Elixir" I just don't buy it I maintain more than 20 packages and, except for the major ones, like Phoenix and Ecto, they haven't been updated in more than a year and yes, they are all fine. The language has been extremely stable. There has been almost no breaking changes in over a decade. Case in point: we introduced a whole gradual type system without making any changes to the language surface! The language is still on v1.x! |
| |
| ▲ | mrcwinn 8 minutes ago | parent | prev | next [-] | | Please share that conversation you reference where the community said Elixir doesn’t need types because it is magic. | |
| ▲ | ramchip 15 minutes ago | parent | prev [-] | | > you don't get bugs related to typing because elixir is somehow magic Really? All the Elixir fans were saying that? |
|
|
| ▲ | dzogchen 8 minutes ago | parent | prev | next [-] |
| The past month I have been going through the Elixir exercism.io track https://exercism.org/tracks/elixir It is really excellent! |
|
| ▲ | misiek08 33 minutes ago | parent | prev | next [-] |
| Im so happy seeing this. We are approaching „great language” level and for me this is the first one. I would be thankful for pointing at any other language that reliably and safely adds great features and is already convenient to use. I jumped from mastering Go to learning advanced C#, because Go stopped with adding great things :( |
|
| ▲ | mrdoops an hour ago | parent | prev | next [-] |
| It's very nice updating Elixir, having no breaking changes across my many projects and it then the compiler just finds bugs for free. I'm so spoiled. |
|
| ▲ | ch4s3 2 hours ago | parent | prev | next [-] |
| This is great, and it looks like 1.20 is compiling our large umbrella app quite a bit faster. |
|
| ▲ | satvikpendem an hour ago | parent | prev | next [-] |
| How does it compare to Gleam? Or rather, why use Elixir over Gleam now? I suppose Phoenix and Live View in particular are big draws to Elixir. |
| |
| ▲ | asib an hour ago | parent | next [-] | | Do you like Rust or do you like Erlang? Writing Gleam is like writing Rust, writing Elixir is like writing Erlang. I don't know the current state of Gleam OTP, but last I checked it wasn't great. If you don't care about either of those things and only about types, use Gleam. But then why not just use Rust? | | |
| ▲ | satvikpendem an hour ago | parent | next [-] | | Your last sentence is basically where I'm at, writing my backends in Rust these days. I'm interested in the BEAM promise of letting things crash but not sure how good that is in Gleam due to its OTP still being somewhat immature as the devs are rewriting GenServer as a typed library. | |
| ▲ | shevy-java an hour ago | parent | prev [-] | | > writing Elixir is like writing Erlang I wrote both Elixir and Erlang code. Erlang is just useless to me as a
programming language; it has many great ideas though. I love the idea
of being able to think in terms of immortal, re-usable, safe objects
(Erlang does not call these objects, but to me this is OOP by Alan
Kay's definition. I don't use e. g. the java definition for OOP.) Elixir built on that and made Erlang code optional, meaning people
could write more pleasent code. And here it succeeded. I am not sure
why Elixir succumbed to type madness now, but the comment that
"writing Elixir is like writing Erlang", is just simply not true. Elixir is significantly better than Erlang with regard to writing
code. José Valim got inspiration for Elixir from ruby, to some
extent. | | |
| ▲ | asib an hour ago | parent | next [-] | | You're taking my comment way too literally. I'm basically just making a syntax comparison. Obviously Rust is not at all like Gleam in many ways either. It's just statically typed and has a similar syntax. | |
| ▲ | satvikpendem an hour ago | parent | prev | next [-] | | Why do you find Erlang useless, you just don't like the syntax? | |
| ▲ | senderista an hour ago | parent | prev [-] | | I agree that actor languages are the purest form of OOP as Alan Kay has expressed it. And unlike Smalltalk, Erlang just accepts that some things are naturally functions, not messages. | | |
|
| |
| ▲ | OtomotO 7 minutes ago | parent | prev | next [-] | | Phoenix and Ecto, really. | |
| ▲ | josefrichter an hour ago | parent | prev | next [-] | | Check Gleam website, they have the comparison right there. | | |
| ▲ | josevalim 5 minutes ago | parent [-] | | Last I checked there were inacuracies. I am not sure if they have been addressed! |
| |
| ▲ | lawn an hour ago | parent | prev [-] | | Gleam doesn't have macros, which many Elixir libraries (such as Phoenix and Ecto) uses to great effect. Gleam for example has issues with verbosity of decoding/encoding json whereas in Rust you derive serde and in Elixir it's just a function call away. Elixir has a more mature ecosystem. While you can for example use Phoenix with Gleam (or some other Gleam framework) the experience just isn't the same. The big draw with Gleam over Elixir is the typing (where Elixir is now closing the gap) and being able to compile to JavaScript (which is also what Hologram is doing for Elixir). I prefer Gleam's typing system and the Rust-like syntax, but for now I feel Elixir is the better choice for all my web dev projects. |
|
|
| ▲ | sevenzero 2 hours ago | parent | prev | next [-] |
| Oh shit here I go (and learn Elixir for a whole year (again)) again. I love everything about Elixir, but Elixir constantly makes me doubt myself like no other language. My brain isnt made for functional stuff, but this makes me want to try again. Sucks that it's not really a beginner friendly ecosystem and usually, when having questions answered, people assume you already know a lot about the language. |
| |
| ▲ | pjm331 2 hours ago | parent | next [-] | | https://pragprog.com/titles/lhelph/functional-web-developmen... don't let the title fool you - the first half of the book is just elixir over the past 8 years this is the book i've used to ramp back up on elixir and it works like a charm every time - i've never finished it for me, a mark of a good programming book in this tutorial-project style is that I have started it half a dozen times and never finished it because at some point before the end I've been equipped w/ the tools to go off and do my own thing | | |
| ▲ | mechanicum an hour ago | parent | next [-] | | FYI, that’s currently available in a Humble Bundle with 16 other PragProg functional programming books: https://www.humblebundle.com/books/ultimate-functional-progr... | | | |
| ▲ | parthdesai an hour ago | parent | prev | next [-] | | There's also the "bible": https://www.manning.com/books/elixir-in-action-third-edition | |
| ▲ | kajman 2 hours ago | parent | prev | next [-] | | I've heard that Phoenix has changed a lot since that book was written. How relevant are those framework specific parts still? | |
| ▲ | sevenzero 2 hours ago | parent | prev [-] | | Yea I've worked through Elixir in Action and appreciate all book recommendations. My issue is, tutorial style books rarely cover security related concerns. | | |
| ▲ | felixgallo an hour ago | parent [-] | | what do you mean by 'security related concerns'? | | |
| ▲ | sevenzero an hour ago | parent [-] | | How to properly build a liveview thats safe against hijacking the websocket phoenix uses for liveviews. You can just do it from the devtools on client side. With regular HTTP requests at least I know what to look out for, with liveview there are almost no resources on how to build a view securely. Like I was able to just call the functions in my module by just addressing them from my browsers console. Just to name an example. | | |
| ▲ | OkayPhysicist 2 minutes ago | parent [-] | | [1] https://phoenix-live-view.hexdocs.pm/security-model.html There's a guide in the LiveView docs that walks you through the security model. To be clear, you need to always assume that the user can send you anything. That's a fact of any networked system: Clients need to be assumed to be completely under the control of an evil user, because at the end of the day it is impossible to know whether you're talking to the client you wrote, or some evil program written by an adversary. Any function that acts as a handler for an event/message can be called by the user, at any time. You have to use session/socket state to handle authorization. |
|
|
|
| |
| ▲ | isityettime 31 minutes ago | parent | prev | next [-] | | > I love everything about Elixir, but Elixir constantly makes me doubt myself like no other language. My brain isnt made for functional stuff, but this makes me want to try again. I experienced this really painfully when I was in college and took a kind of "survey of programming paradigms" course and tried Haskell for the first time. I'd been programming for years by then, and I couldn't believe how helpless I was at trying to complete things that had long felt "basic" to me. But I don't think it's about the brain not being suited, I think it's that contrast of your experience level in imperative languages vs. the fact that when working in a pure functional style, you start out as a newbie again. I think you'll gradually improve. I think the thing that finally made functional programming feel comfy for me was realizing how much I love composing code that basically feels like more generously spacer Bash "one-liners". The data starts out in one shape, so you run a command to dump it. Then you think of a step that gets it closer to what you want, you pipe it to that next command, and you take another look. And you keep going and at the end what you're looking at is typically pretty close to a series of transformations of data that you never mutate! Part of what makes this feel comfy in the shell is that you build up that vocabulary of commands just by puttering around your file system every day. Over the years my library of familiar "functions" in a Unix-like environment has grown quite large. In a pure functional programming environment, you have to do the same thing but it takes a little more effort to learn the vocabulary. Your most frequently used "commands" will be functions like map, fold, and zip instead of grep, cat, or sort. But the core of it is really the same, and what I love about building pipelines applies equally to both: you can build it piece by piece, and for each puzzle you're on, you can forget about the previous steps and just think about the next transformation of the data that's in front of you. There is something refreshingly, relaxingly low-context about that. Anyway I hope you give it a try and enjoy it. When we can learn to enjoy being bad at something, that's how we finally get good at it. | |
| ▲ | pdimitar 2 hours ago | parent | prev | next [-] | | I invite you to ask on ElixirForum. I have never seen a truly hostile response. Sometimes posts don't get traction due to ambiguity, and some smelled like "do my homework" so people ignored them. But every post with a genuine curiosity in it gets answered, as far as I can tell. | | |
| ▲ | sevenzero 2 hours ago | parent [-] | | Yea I've posted there twice as far as I remember. You will absolutely get help, whether you understand the answers is a whole different story. Elixirs community is great. Its just hard to learn because it's not yet widely adopted, there are no (non senior) roles for it and it's a lot of work understanding all the BEAM concepts. A thing just being interesting isn't enough motivation for me to learn, I need a bigger goal but with Elixir there do not seem to be any. My last experience with it was building something with Phoenix Liveview until I noticed how easily you can hijack the websocket and just spam random commands to your server or temper with payloads (with regular webapps ive built i never had this issue). Which made me quit that project. | | |
| ▲ | pdimitar 2 hours ago | parent | next [-] | | Fair. If you have this friction then it's not worth pursuing. One thing that really helped me pick it up was saying YOLO and rewriting one part of the business stack from Ruby on Rails to Elixir. It taught me quickly and well. The official guides are also great and IMO you can get through them all without a rush in two weekends. But again, if you don't want to then don't. You can also try asking right here in this HN thread. Maybe I or others would be willing to give you a more detailed response. | | |
| ▲ | sevenzero 2 hours ago | parent [-] | | When building I couldn't get "what if I have ghost processes", "what if I spawn too many processes", "what if this architecture is bad compared to...", "when to kill processes", "whats the correct restart strategy for this" out of my head... It's so confusing to build for the BEAM that I ultimately gave up on it. | | |
| ▲ | pdimitar 2 hours ago | parent | next [-] | | Ah, true. You are right this assumes some familiarity. Definitely a gap. Check this out: https://www.theerlangelist.com/article/spawn_or_not Written by one of the very best Elixir mentors. I believe it will dispel most (hopefully all) of your doubts and clear things up. | | | |
| ▲ | toast0 20 minutes ago | parent | prev [-] | | > "what if I have ghost processes", I'm not sure what a ghost process is? I guess something that's living beyond its usefulness / isn't supervised, etc? ... I don't speak Elixir, but you can do the equivalent of this Erlang to see everything on the node: rp([{X, erlang:process_info(X)} || X <- erlang:processes()]).
Then you'll know what's going on. Caveat: if you have a lot of processes, that's going to use a bunch of memory; for production you probably don't want to use erlang:process_info/2 with specific items instead of the default items. And you might don't want to output something for all the processes if you have a lot of "normal" processes that won't need to be listed.> "what if I spawn too many processes", The default limit is 1,048,576, if you want to have more, you can add +P X to the erl command line with a bigger limit? Have your monitoring alert you when you're at ~ 80% of the limit. > "what if this architecture is bad compared to...", This probably addresses the real question of your too many process question. If your architecture is bad or if you spawn more processes than a good architecture would, your performance will be bad. If your architecture is really bad, you'll have a hard time solving the problems you're trying to solve. Future you will look upon your system and despair; you may also despair in the present... Eh, you're going to make bad architecture. BEAM won't solve all your problems. But, if you've got problems it can solve, IMHO, it can be a very nice way to solve them. > "when to kill processes", Kill processes (or let them crash) when they misbehave. Kill them (or let them exit normally) when they've done their work and they don't have anything else to do or wait for. When you spawn a process, you'll often have a pretty good idea of the conditions that would lead to its death... Ex: if you spawn a process to handle a connection, it should probably die around the time that the connection ends. If you spawn a process to handle a request, it should probably die when the request is handled. If you spawn a process to listen for connections, it probably should die when you don't want to listen anymore. Etc. > "whats the correct restart strategy for this" Well... it depends. Almost never the default strategy. The default strategy is a big foot gun; at least it is for Erlang, maybe they changed it in Elixir. I need zero hands to count the number of times I actually wanted BEAM to stop because some supervised process failed 3 times in a small time frame; but it's happened to me a lot more times than that. For per connection or per request things, the appropriate strategy is not to restart at all; for other things, try to restart a few times quickly then maybe every minute or so is probably sufficient. You'll want some sort of alerting. And if the restart strategy isn't right, you can always console in and poke it. |
|
| |
| ▲ | ch4s3 2 hours ago | parent | prev [-] | | > whether you understand the answers is a whole different story. You can always ask follow up questions for clarification, people there are generally really friendly. |
|
| |
| ▲ | mihaelm 2 hours ago | parent | prev | next [-] | | Do you maybe know some Rust? I'm also not that experienced with FP languages, but Gleam felt familiar enough, due to some Rust-isms, to allow me to focus more on the concepts rather than the syntax. Granted, I spent a few afternoons with it, but if I were to pick a FP language again to wrestle my brain into submission, I'd probably go with Gleam due to familiarity. | | |
| ▲ | sevenzero 2 hours ago | parent [-] | | I gave up on Rust even quicker than on Elixir haha. But yea I know about Gleam and I did build some fourier transform stuff with Rust a while back. I like Gleam generally. I am just much much slower with FP and think its extremely unintuituve compared to, say, Go for example. |
| |
| ▲ | jimbokun 2 hours ago | parent | prev | next [-] | | Comments like this always confuse me as object oriented programs riddled with state are much harder to reason about to me. | | |
| ▲ | sevenzero an hour ago | parent | next [-] | | The confusing state riddling here happens in the background as your whole app basically is a state. The thing that really throws me off with Elixir is having to handle (possibly) hundreds of thousands of processes. Doing this correctly seemed impossible to learn for me. | | |
| ▲ | sph an hour ago | parent | next [-] | | It's not like you're dealing with hundreds of thousands of ad-hoc processes. If you're writing a web server, for example, each of these processes might simply be a client connection and they all operate the same. The fact that there are 2 or 100,000 is only a problem for the BEAM scheduler. Sounds like there is some foundational knowledge of Elixir that you miss and everything seems more confusing than it should be. To me writing a 'server' in Elixir is orders of magnitude easier than doing it in Python, Rust or C++. As someone else suggested, bring your concerns to the Elixir Forum and surely someone will clarify them for you | |
| ▲ | jimbokun 29 minutes ago | parent | prev [-] | | But would be even harder to wrap your head around if you tried to implement similar capabilities in Java. |
| |
| ▲ | sph an hour ago | parent | prev [-] | | I'm working on a game engine right now (written in object oriented language, of course) and I keep itching to design a compiled functional language for games, because state spread in thousand of objects, eldritch class hierarchies, are complete hell. Once you taste Elixir/Erlang, there is no going back to the madness. |
| |
| ▲ | adamddev1 an hour ago | parent | prev | next [-] | | Do https://htdp.org and follow all the exercises carefully (yes, it will feel like baby work at first) - you will retrain your brain for functional stuff. :-) | |
| ▲ | ai_critic 2 hours ago | parent | prev | next [-] | | What functional stuff is throwing you off? A whole bunch of it can be written procedurally when starting out. | | |
| ▲ | sevenzero 2 hours ago | parent [-] | | With Elixir specifically it was the learning experience I had with Phoenix. I didn't understand how a Phoenix app booted, didn't know where to edit my config.
Syntax like: ```
socket "/ws/:user_id", MyApp.UserSocket,
websocket: [path: "/project/:project_id"] ``` Elixir gives you too much freedom on how to write something on a syntax level which really annoyed me. | | |
| ▲ | solid_fuel an hour ago | parent | next [-] | | I love Elixir and Phoenix, but Phoenix especially uses a lot of compile-time macros and it can be a steep learning curve when you need to pull apart the skeleton framework to figure out how things are actually wired. I pretty frequently find myself needing to open up the source to understand what's actually going on, the docs aren't bad but it often feels like they assume a lot of existing familiarity with phoenix. In this example, `socket` is a compile time macro and it's being called with path = "/ws/:user_id"
module = MyApp.UserSocket
args = [
websocket: [
path: "/project/:project_id"
]
]
and what is does is register that data with the `phoenix_sockets` attribute inside the module you called `socket` from. At compile time that gets turned into a lookup inside your module, and presumable then the UserSocket module is invoked when a websocket request hits the specified path.Would you find it more clear if socket was called like this? socket("/ws/:user_id", MyApp.UserSocket, [websocket: [path: "/project/:project_id"]])
Or, alternatively, would it help if the endpoint was more specifically defined like defmodule MyApp.Endpoint do
use Phoenix.Endpoint,
otp_app: :my_app,
web_sockets: [
socket("/ws/:user_id", MyApp.UserSocket, [websocket: [path: "/project/:project_id"]])
]
end
| | |
| ▲ | sevenzero an hour ago | parent [-] | | I think the lack of parentheses is whats throwing me off regularly with Elixir. | | |
| ▲ | solid_fuel an hour ago | parent [-] | | I find the optional parentheses, and the way that keyword lists are defined to be the two biggest stumbling blocks when I come back to Elixir after a while way. Coming from other languages, I find that example("with", 3, extra: "arguments", as: "a", keyword: "list")
being equivalent to example("with", 3, [extra: "arguments", as: "a", keyword: "list"])
and example "with", 3, extra: "arguments", as: "a", keyword: "list"
always takes some extra mental effort to get through, especially when there's no parenthesis. But I appreciate not having to write all the extra brackets and parens when I get going, so I think it's a fair tradeoff. |
|
| |
| ▲ | ch4s3 2 hours ago | parent | prev [-] | | > Elixir gives you too much freedom on how to write something on a syntax level This is true perhaps compared to python or go, but not compared to Java, JS/TS, or some others. > socket "/ws/:user_id", MyApp.UserSocket, websocket: [path: "/project/:project_id"] Socket is a behavior, which is like a trait or interface. MyAppWeb.UserSocket implements the behavior. It's basically a convenience over having to write a bunch of repetitive WS or long poll handling every time you want a socket like thing. Its pretty well documented https://phoenix.hexdocs.pm/Phoenix.Socket.html. |
|
| |
| ▲ | cpursley 2 hours ago | parent | prev | next [-] | | I find beginners respond well to this resource: https://joyofelixir.com/toc.html | |
| ▲ | qaq 2 hours ago | parent | prev [-] | | community is super nice I am sure you will get help. |
|
|
| ▲ | OtomotO 14 minutes ago | parent | prev | next [-] |
| Yes! I have the great luck to work in many different stacks as a freelancer. One of them is Elixir. While I am on this project for just half a year and not too many hours per week, I can say: I absolutely love this language. It reminds me of Haskell, which I had courses on at university, and is just an absolute joy to work with. My only gripe was that there was no typesystem. So I was eyeing Gleam (as I also like Rust very much), but as Gleam doesn't and probably never will support Ecto and Phoenix (due to it not supporting macros), it's a nogo for the project at hand. I knew Elixir was to gain a typesystem, still this is absolutely fantastic news.
Super stocked to work with this. |
|
| ▲ | WolfeReader an hour ago | parent | prev | next [-] |
| Wonderful. I know several devs who were turned off of Elixir because of bad experiences with dynamic typing. Hopefully this helps! |
|
| ▲ | 7bit 2 hours ago | parent | prev | next [-] |
| Found elixir intriguing and so Phoenix. Two reasons I put it aside again are: You need Beam and the Elixir. I find that really weird, because I'm used to just the language like in Python, Java, C, Rust. Not something underneath it, too. There is no debugger. The way to debug Elixir is to print stuff to the console, like 40 years ago. No thanks. |
| |
| ▲ | victorbjorklund 2 hours ago | parent | next [-] | | That is just wrong. > You need Beam and the Elixir. I find that really weird, because I'm used to just the language like in Python, Java, C, Rust. Not something underneath it, too The beam is a VM. You get that Java requires a VM too right? It’s called JVM for a reason. And Python requires an interpreter. > There is no debugger. The way to debug Elixir is to print stuff to the console, like 40 years ago. That is false. https://www.erlang.org/doc/apps/debugger/debugger_chapter.ht... and you have observer. And you have a lot of other debugging tools. I hear Java has a good one and maybe it’s better (I never used it) but it’s not true there exist no debuggers for the beam. | | |
| ▲ | Spixel_ an hour ago | parent [-] | | Almost nobody uses it though, which is too bad, especially since multi-head functions sometimes make it difficult to follow the execution path. I'd like to do step by step but I cannot plug the debugger to VScode from inside a docker container. | | |
| |
| ▲ | lionkor 2 hours ago | parent | prev | next [-] | | Java has the JVM the same way that Elixir has Beam/OTP/... | | |
| ▲ | hackyhacky 2 hours ago | parent | next [-] | | And CPython runs Python bytecode, which is basically running in a Python virtual machine. I am not sure what GP is objecting to. | |
| ▲ | 7bit 2 hours ago | parent | prev [-] | | Read again... Here's what you need to do for elixir: Download and run the Erlang installer
Download and run the Elixir installer Here for Java:
Download and run the Java SDK And for Python:
Download and run the Python installer | | |
| ▲ | sbuttgereit an hour ago | parent | next [-] | | If you're going to try and use this analogy, you need to compare Elixir to Kotlin or Scala or Clojure rather than Java. Elixir is a language written for the BEAM which was created for Erlang. The BEAM happened to be useful VM for these other languages such as Elixir, Gleam, LFE, & Luerl. | | |
| ▲ | 7bit an hour ago | parent [-] | | No, I don't. I'm not writing gleam etc for the same reasons. | | |
| ▲ | dematz 39 minutes ago | parent [-] | | If you don't want to then fair enough :) that said if your problem is just installation, some of the gleam people realized it can be tricky and made a nice guide for various operating systems and package managers: https://gleam.run/install/ Note this includes installing erlang as well While it is multiple steps, the frustration is a much more one time thing compared to the problems and frustrations you'd have using a language or its ecosystem for a long time or big project |
|
| |
| ▲ | freedomben an hour ago | parent | prev | next [-] | | For Java you need a JRE and JDK depending on whether you're just running or also building. That they are bundled (for Windows) is slightly convenient, but they're not bundled on Linux so what you're saying is OS dependent | |
| ▲ | dematz an hour ago | parent | prev | next [-] | | Is your issue something with the runtime itself, or just the difficulty of installing it? | | |
| ▲ | WolfeReader an hour ago | parent [-] | | I think the issue is "I have to install two things instead of one thing" which is a pretty weird way to judge a programming language. I guess we know how he feels about TypeScript. |
| |
| ▲ | sokols an hour ago | parent | prev | next [-] | | To use Python/Java you have to download and install an OS.
(Though some versions might run on bare metal) | |
| ▲ | WolfeReader an hour ago | parent | prev [-] | | Here's what you need for Java: Download SDKMan/Jenv Install the version(s) of Java you need for your projects Make sure your JAVA_HOME environment variable is set Ensure your IDEs locate the correct Java home Compared to all that, Elixir's two installers are trivial. And if you have a competent package manager, you can just tell it to get Elixir and it'll handle Erlang for free. | | |
| ▲ | vips7L 20 minutes ago | parent [-] | | No you don't. The process is exactly the same for Java. | | |
| ▲ | WolfeReader 6 minutes ago | parent [-] | | Nah, I work on a team that has multiple microservices written over the years in different versions of Java. "Just click the installer" is not sufficient. That's why programs like jenv, SDKman, nvm, and others even exist (and are popular). Your lack of real-world experience is showing. |
|
|
|
| |
| ▲ | freedomben an hour ago | parent | prev | next [-] | | If you're used to Java, Elixir is like `javac`, Beam is like `java`. Mix is like a (way better) version of Gradle. You need elixir to compile your app, you only need the Beam to run it. Once you've built your project, you don't need Elixir anymore exactly like java/javac. C and rust compile to machine code so don't have a runtime dep, but otherwise they still require you to have a compiler at build time, just like elixir. | |
| ▲ | wkrp an hour ago | parent | prev | next [-] | | To be fair, there is more than just print debugging. You have access to tools like red(x)bug https://github.com/nietaki/rexbug, the Elixir-LS project has Debug Adapter Protocol support. And in my opinion, the REPL (and decent software architecture) makes it easy to investigate your code by just running the functions as needed (even if your live production system if you want). | |
| ▲ | hmmokidk an hour ago | parent | prev [-] | | I genuinely needed that laugh. Thank you | | |
|
|
| ▲ | shevy-java an hour ago | parent | prev [-] |
| Guys, I am sorry for your loss here. def example(x) when not is_map_key(x, :foo)
I think this also shows that merely copy/pasting
ruby's syntax, isn't an automatic win. I noticed
this before with crystal, though naturally crystal
had types from the get go.Fundamentally: def foo()
end
should stay simple. And this is no longer the case now.(Ruby also went in error, e. g. "endless methods". I don't
understand why programming languages tend to go over the
edge in the last 5 years or so.) |
| |
| ▲ | josevalim an hour ago | parent | next [-] | | The syntax you are commenting on has always existed in Elixir, before v1.0, as part of patterns and guards. You are commenting as if we added this now but we have made no changes to the language surface. The difference is that we now leverage these same language constructs to extract precise type information. | |
| ▲ | andy_ppp an hour ago | parent | prev [-] | | You can of course still do the second thing, the types are not forced if you don't want them! |
|