11 ms·
Elixir for cynical curmudgeons
- whalesalad 3y agoThe a-ha moment when you grok "Elixir is actually a Lisp" is very exciting indeed. It's a beautiful language that fits all of its elements together so nicely.
- davidw 3y agoThat's a pretty good write up. There's a fine line between making things easier and more readable and having less boilerplate code, and pouring a bit too much magic and macros into things. I'm always curious to see what people do with Elixir. The BEAM environment offers a lot in terms of a platform, but if you're just using it to serve web dynamic web pages, Rails is going to be a better pick in some circumstances because of the huge number of libraries, people who know it, documentation, hosting and the rest of the ecosystem.
- cschmatzler 3y agoPhoenix is obviously “the big thing” and no other language/framework combination has something as good as LiveView. Rails cannot compete there. Other than that, building Livebook apps for our customer success team has been really great and easy. There’s quite a big push for ML in Elixir right now, and then there’s also Nerves for embedded programming, which I’ve never dabbled in but it looks nice.
- OkayPhysicist 3y agoLiveView is definitely Elixir's killer app. It's what takes Phoenix from "a really good web framework" to "the singular best web framework", in my experience. Ecto is also a best-in-class data-layer adapter (ORM seems wrong and reductive).
- sethammons 3y agoI'm primarily a Go developer who loathes ORMs. I have to admit that Ecto is pretty great.
- cultofmetatron 3y agoecto is also just an amazing db wrapper in general. you basically write sql in elixir which means you can optimize the crap out of your queries and its easy to steop down to actual sql where needed via fragments.
- hosh 3y agoAnd you can still use composable queries if you still want to (equivalent to Rail’s named scopes).
- slekker 3y agoDo you have any write up about Livebooks for your CS team? Sounds like an interesting use case!
- metaltyphoon 3y ago> no other language/framework combination has something as good as LiveView You just have to look. Blazor does what LiveView do and on upcoming. NET 8 it will leapfrog it.
- porker 3y agoPeople have been saying this about Blazor for years, and it's never reached that point. Where can I see what .NET 8 will bring to Blazor to change this?
- OkayPhysicist 3y agoAs someone currently using bleeding edge Blazor at work, and Phoenix on my own time, this is wromg to the point of comedy. The big thing that LiveView has going for it is that it transforms the client session into just another process to communicate with, using the same message passing tools as the rest of the language, with very little headache because concurrency is already an expectation. Blazor can never achieve this, because C# is not a concurrency focused language.
- sodapopcan 3y ago> Rails is going to be a better pick in some circumstances because of the huge number of libraries. This isn't really as big a problem as many people think. I've been out of Rails for a while now but haven't really felt the pain of missing anything with Phoenix. I've noticed there aren't often Elixir wrappers around third party APIs, but those are really not a big deal to create a small version on your own with only what you need. I always used to wrap the wrappers anyway! As far as UI stuff goes, there are actually a lot of really nice vanilla JS libs out there which play really nicely with LiveView's JS hooks. I would be interested to hear what people have been sorely missing, though. EDIT: Said "are" when I meant "aren't"
- arrowsmith 3y agoYour experience matches mine. And ChatGPT has been a game-changer - if there isn't an Elixir library for some third-party API, GPT is very good at generating some wrapper functions in Elixir using the API docs.
- davidw 3y agoOh, I don't think the library thing and ecosystem is really an obstacle for using Elixir so much as it makes Rails a 'safe bet'. If I'm putting on my business hat, I need a reason to use Elixir instead of Rails and that probably has something to do with a better concurrency story, but I'm always curious to hear what other people are getting out of it. My previous experience with BEAM was using Erlang in a semi-embedded environment and it was fantastic for that. Solid, dependable, deterministic, great response times... all of that. But while we did have a web interface to the system, it wasn't a web site.
- bcrosby95 3y agoFor us its the simplified production environment. We use BEAM's clustering capability to forgo things like redis and/or a message queue. It probably doesn't matter for every company, but it helps for us where we have zero full time ops people.
- 3y ago
- pdimitar 3y agoThe transparent parallelism makes it an amazing fit for pretty much anything and everything that doesn't require minimum system resources and microsecond-level of response times. 1. Web apps work awesomely because they tolerate sudden bursts of load much, much better than Rails. Rails deployments regularly fall over on bursty workloads unless complex load-balancing setups have been put in front of them. 2. Which brings me to: operations / infra story is much simpler, and it is thus cheaper and easier to maintain Elixir apps, even when they span multiple nodes (because Erlang's builtin mechanism to do mesh networking / distribution works well enough for 99% of the projects out there). 3. Complex service trees f.ex. scrapers that also present their data in a visual CMS backoffice UI and background tasks infrastructure -- all of that can live on literally the same node, share the same code repo and be very easy to manage and maintain as a result. 4. Oh, that also reminds me: almost anything and everything you would need Redis for, you can have it natively with Erlang/Elixir. 5. Corollary to point 3: long-lived daemons that are not even web apps / APIs work really well under Elixir due to the supervision tree guarantees of Erlang's underlying OTP framework. If you configure it well (the defaults are not always optimal) you can have your invisible mesh of services survive extended outages of the 3rd party APIs it depends on. 6. In the last years, LiveView and Livebooks are amazing additions that help severely reduce the need of JS and provide an alternative to Jupyter Notebooks, respectively. Though it has to be said that LiveView works best when the latencies to the backend aren't too big, say, 200ms or less. Beyond one certain human perception threshold it starts to feel sluggish however. I could go on and on and give plenty of examples from my career. I've replaced a lot of shell scripts and PHP / Python / JS services with Elixir, and each migration was a crushing success in every way. We're talking 15+ such projects. Only 1-2 of them got back to their original language simply because the companies / teams were too risk-averse and didn't want to hire Elixir devs (or train their current people). But the network effects are always a chicken-and-egg problem; if people never want to bet something on the tech then it obviously is never going to be appealing to them. There are many who made the plunge though and are happy with the results.
- davidw 3y ago> If you configure it well (the defaults are not always optimal) you can have your invisible mesh of services survive extended outages of the 3rd party APIs it depends on. This is something that annoyed me a bit with OTP. The basic strategies aren't really enough for that, so you need something like https://github.com/jlouis/fuse https://github.com/jlouis/fuse I wrote something like that myself, but it hasn't seen a ton of use: https://github.com/davidw/hardcore https://github.com/davidw/hardcore
- megaboy101 3y agoWhere I previously worked we used Elixir as the backend for a early-stage social app. We only really encountered the lack-of-libraries issue a single time (we needed a Neo4j driver that supported their hosting platform). But aside from that, Elixir was a great choice and served us well. When our app went semi-viral all we needed to do was increase our instance size in AWS, never really needed to worry about horizontal scaling thankfully. Our app also needed a lot of realtime messaging and updates, which was genuinely a breeze with Phoenix. I don’t think I could ever to back to trying to finagle a websocket API in Python.
- hosh 3y agoIf anything, scaling Elixir apps favors vertical scaling. Horizontal scaling starts hitting the limits of dist erlang (since, unless you restrict the topolog, every node connects with every other node). It makes for an interesting time when deploying to Kubernetes. But we figured out how to increase the number of cores per erl node during peak daily traffic. I’m working for a Nodejs shop now. For all its use of async stuff, it simply does not scale as well as Elixir (not to mention the deep dysfunctions in the Nodejs ecosystem).
- dsiegel2275 3y agoIf I recall the things I've read on this in the past, the horizontal scaling limitations of distributed Erlang are encountered around like 500 to 1,000 nodes? Which I have to imagine means the large, large majority of shops using Elixir and scaling horizontally will be just fine, as they are typically in the size of 2 - 10, or maybe 20 nodes.
- hosh 3y agoThere is a reason stuff like Partisan were conceived - https://arxiv.org/abs/1802.02652 https://arxiv.org/abs/1802.02652 If you do a lot of cross node talk with say, the Phoenix channels, then lowering the total number of nodes helps (n*(n-1) for a full mesh). And since the BEAM scheduler will try to use up all available cores by default, past a certain threshold of nodes, it makes more sense to use smaller numbers of nodes with more cores per node. When you also have say, an observaility agent taking up 1000 mcore, doubling the instance size makes a difference. In the last shop, we would idle at 4-cores, jump to 16-cores instance sizes for the morning rush, and go back to 8-cores for the late afternoon traffic. I had tried to horizontally scale it with 4-cores machines, but saw a lot more instability and performance issues. This is one of the advantages with using Elixir or Erlang. You simply don’t get this kind of operational characteristics with Ruby, Python, or Nodejs.
- hosh 3y agoHaving done both Rails and Elixir, Elixir is vastly easier to scale. Not just because it can use up all the available cores, but also because a REPL in a production environment makes troubleshooting and identifying bottlenecks easier. When I scaled Rails, it was a struggle, and the epiphany I had when I had to modify how Sidekick worked was that Elixir and Erlang had built-in primitives to do what is major refactor of Sidekick to get Sidekick to do what I want. One of the things I had success with in a non-web applications is writing Kubernetes Operators in Elixir. Though I also want to experiment with the embedded Prolog-in-Elixir for those.
- golemotron 3y agoDisappointed. I thought it was going to describe a way for cynical curmudgeons to get out of their rut.
- stilwelldotdev 3y agoI've landed on SvelteKit and classless CSS for most of my hobby projects. I am interested in Elixir though, especially Phoenix, but found it to be difficult to manage and get started with in Windows. Still looking for the easy way into learning to work with web sockets as a 41 year old man with very little spare time.
- toldyouso2022 3y agoUse virtuabox and make a vm with ubuntu, install elixir and connect via ssh. This is what I did when I wanted to try it out but only had win8
- stilwelldotdev 3y agoIn my opinion, this is just too much effort these days.
- _joel 3y agoWSL2 should get you going?
- stilwelldotdev 3y agoWSL2, while amazing technology, is a resource hog and still a bit buggy in my experience. I use it w/ linux from time to time when I don't have a choice, but when I'm coding, it just feels like a hyper-bloated IDE.
- freedomben 3y agoThat's what I would suggest as well. WSL2 and use asdf[1] to manage the erlang/elixir versions. You could also use containers pretty easily as well with docker or podman for windows and the official Elixir images[2]. [1]: https://github.com/asdf-vm/asdf https://github.com/asdf-vm/asdf [2]: https://hub.docker.com/_/elixir https://hub.docker.com/_/elixir
- victorbjorklund 3y agoWhat is "classless CSS"? Just using style attributes?
- chubot 3y agoI'm also looking at Elixir and Phoenix (coming from Python/C++), and it looks cool. Doing realtime features with Python requires something like Tornado / asyncio, which isn't ideal IMO. I'm all for the immutable / message-passing architecture in the large, but I wish that you could just write Python-style code within processes. The VM copies all data structures at process boundaries anyway. I think that language would be very popular! I wrote Lisp 20 years ago, before Python, but now it feels a little annoying to "invert" all my code, for what seems like no benefit e.g. from https://learnxinyminutes.com/docs/elixir/ https://learnxinyminutes.com/docs/elixir/ defmodule Recursion do def sum_list([head | tail], acc) do sum_list(tail, acc + head) end def sum_list([], acc) do acc end end I would rather just write def sum_list(L): result = 0 for item in L: result += item return result But then also have the Erlang VM to schedule processes and pass immutable messages. There is obviously a builtin in Python that does this, and I'm sure there is a better way to do this in Elixir. But I think the general principle does hold.
- bcrosby95 3y agoBuilt ins aside, I find most uses of recursion to be better served by Enum.reduce.
- chubot 3y agoYeah I knew someone was going to say that (see last sentence), but a for loop is more powerful and general than reduce(). Mutability within the loop is useful, and it can be controlled by processes and message passing.
- bcrosby95 3y agoI assumed you meant something like Enum.sum that completely trivializes the code. In comparison, generic, higher level functions are pretty fundamental to FP.
- sodapopcan 3y agoI'm not sure "powerful" is the right word here, it's more a matter of "what certain people are used to". If you want a counter or whatever, you can use a tuple to give yourself multiple accumulators. You could argue it's uglier, but I wouldn't necessarily agree. It's something that is easy to get used to if you remove the "but I'd rather just do it this way" mindset.
- throwawaymaths 3y agoYep. The only problem with elixir macros is that people look at the macros that are in core++ (exunit, plug, phoenix, ecto) and decide it's a good idea to dsl-up everything. The biggest offenders IMO are commanded, Tesla, absinthe, exmachina and now most recently ash. Then there's tons of tiny libraries that litter hex.pm with macro-heavy nonsense. At least the core++ libraries make macros whose syntax/keywords matches something outside elixirland that you'd have to know anyways (e.g. 'get' from plug, all of SQL from ecto), but the big offenders list are making up clever names for things, which adds mental overhead to literally everything you do, building crazy complicated compilation pathways (especially for overeagerly lazy stuff) or writing function names from whole cloth that make refactoring or searching your codebase a nightmare (or more than one). E.g. if you're working in a domain where non-proud camel case is the convention, don't automatically snake-case it.
- freedomben 3y agoYep this is definitely a problem, but fortunately the culture/community around Elixir generally tends to frown on unnecessary macros. I heard the saying, "if it can be a normal function, it should be" many times, which pleases me. Overall though this isn't something I've generally run into too much with Elixir.
- throwawaymaths 3y agoMark my prediction: as the big "non-core++" libraries get bigger and trashier with their macros, and more used by the community, hex.pm will become littered with even more trashy macro libraries, and people will stop saying "don't use macros".
- cschmatzler 3y agoI’m pretty sure that the libraries you consider core++ such as ExUnit and Ecto are considered feature complete and won’t get any bigger.
- 3y ago
- freedomben 3y agoWhat a terrific write up! I highly recommend the read. I too had an ephiphany when I realized Elixir was actually a Lisp. The language went from mildly interesting to "holy crap I think this could be my favorite language." Add on some wildly productive and pragmatic frameworks like Phoenix, Nerves, and increasingly Nx, and you've got a hell of a toolkit. My biggest criticism of Elixir has been the difficulty of writing quick scripts, but that story has improved greatly over the last couple of years. I still turn to Ruby for scripts (especially since it's often present on systems and so easy to install), but this is a good reminder that it's time to try Elixir again for that. In some ways it may be better, such as dealing with dependencies. For exmaple I try hard to avoid using any non-standard libs with Ruby scripts so I can just use the system ruby, and don't have to ship a Gemfile and/or install any gems, or mess with chruby/asdf. With Elixir that story looks even better since the deps can be part of the script itself.
- sergiotapia 3y agoHere's a great repo showcasing how to use it more like a quick scripting language. https://github.com/wojtekmach/mix_install_examples https://github.com/wojtekmach/mix_install_examples
- capableweb 3y ago> I too had an ephiphany when I realized Elixir was actually a Lisp. Is it actually? Last time I looked at Elixir (granted, that was a while ago), the syntax for writing macros was different than the syntax for writing ordinary code, so it fails even at a simple thing like that, it doesn't seem to support homogeneous meta-programming at all. But again, I feel like I might be wrong here and I'm happy to be proven wrong.
- sodapopcan 3y agoYa, it's not actually a lisp. I can't find the source but José has stated part of the idea was to give you lisp-like metaprogramming with a non-lisp syntax (sorry, José, if I have mis-quoted). Even the regular syntax is sort of lispish, though, if you remove the syntactic sugar. It's all macros and datastructres. defmodule Foo do def bar do "baz" end end is really: defmodule Foo, do: (def bar, do: "baz") ...which is lispish if you squint the right way.
- throwanem 3y agoSeems struggling at the moment. Archive link: https://web.archive.org/web/20230803145324/https://wiki.alopex.li/ElixirForCynicalCurmudgeons https://web.archive.org/web/20230803145324/https://wiki.alop...
- weatherlight 3y agoElixir is probably my favorite dynamic language and a lot of that has to do with the community that sprung up around it. I wish it were more popular.
- hosh 3y agoI don’t wish it to be super popular. I heard the argument before that JS (and Nodejs) is popular (top 3), so you should go into it. I’m now in a nodejs shop. Turns out, the way Erlang and Elixir is designed serves as a filtering function for hiring. People who just wants to code without putting a lot of thought into it, don’t go into Elixir and land in JS instead. (All the current coworkers I have wants to make things better but we are saddled with code that has been … oddly written) At the last Elixir shop I was at, I was part of a small crew that was more experienced as a whole than other shops I have been at. And I liked it.
- no_wizard 3y agoPopularity is a multiple faceted issue w/r/t quality of engineers in any given language. One caveat to any of it is the easier a language is to grok and the more use cases it has, the more likely it will attract all types of developers and there will always be more "bottom end" developers than "top end" developers, as is patterned out in any large distribution. That said, here's some facets to consider about this - Its not likely its the language (or to be charitable, not just the language) at play here. As noted above, the more popular something is, the more likely you end up with a wider varieties of folks at very different backgrounds / skill levels etc. Python and PHP have similar issues. - The more popular the language is, is often correlated to its use cases. For example, JavaScript is hugely popular in a wide swath of problem domains, from the server, to the web (its de facto monopoly right now) to desktop apps to even now mobile (Ionic, NativeScript etc). This leads to the top developers in the language often going to very lucrative positions that one would also presumably have to be working alongside or as part of to be working with them - Its harder in a bigger pool to work with the top N % of developers in any given language or (better yet, any given environment / problem space deploying that language as part of its core technological backbone). The big "sea" in the middle is what you're most likely to be apart of I think smaller communities benefit from organic interest, people who are enthusiastic to use the technology and therefore often the perceived quality of those developers is higher (and often it does correlate, see: the history of Clojure) I don't think a language in and of itself is to blame, except in that maybe, because some languages like Python and JavaScript are so easy to pickup as opposed to say, Java, Kotlin, C# or Rust, that they attract more developers in general. That said, I think its the laws of distribution at work, and not really the driven by the language per se.
- LispSporks22 3y agoLisp user here. I couldn't see what he was talking about re: "Elixir is a Lisp" and the "why" was pretty hand-wavy, but the author does seem pretty stoked about whatever he/she saw so good for them.
- weatherlight 3y agohygienic macros doe not make a lisp, but.... it get you very close to the spirit of the thing, i think that's why the author was excited,( and it's a good reason to be.)
- cmcaine 3y agoIt's got good macros and the implementation of both regular code and macros operate on the same core datastructures. It has the interactive features for inspecting and modifying a running system that Lisps often have. It has reflection APIs Its ints are big like Lisp etc. Seems pretty Lispy to me.
- BaculumMeumEst 3y agoelixir seems cool and i love its tooling but the more i use datomic, the less i want to spend my time dealing with SQL and its baggage unless i absolutely have to.
- whalesalad 3y agowhat would prevent you from using datomic with elixir? https://github.com/edubkendo/datomex https://github.com/edubkendo/datomex there are other datalog-y tools as well, ie https://github.com/naomijub/translixir https://github.com/naomijub/translixir
- BaculumMeumEst 3y agoi lost my enthusiasm for building a jenga tower of niche community libraries
- whalesalad 3y agothat is literally clojure development
- BaculumMeumEst 3y agoyou can get pretty far with cognitect's libraries and java interop
- dgb23 3y ago> the harder something tries to convince me of anything, the more I expect it to suck. That's me vs web development in general and especially in the JS ecosystem. Other, similar red-flags: hand holding, "best practices", "anti-patterns" and other voodoo and cargo culting. The most suspicious one is prettiness: - custom DSL syntax without data representation - cosmetic wrappers that are just thin layers without substance - "everything is an X" for the sake of faux consistency
- 59nadir 3y ago> - custom DSL syntax without data representation This is an interesting comment in a post about Elixir because the Elixir ecosystem is actually full of things that should just be data but are instead macros being used in modules. Phoenix in particular is an especially egregious example of a library that is badly made in almost every regard > - cosmetic wrappers that are just thin layers without substance This one is also funny because Elixir itself is little more than a fairly small set of convenience libraries, a syntax and a very good tool for project management (`mix`) on top of Erlang. You can skip the syntax and the convenience libraries for the most part and actually just use Erlang in a `mix` project and get the best of both worlds. The convenience libraries usually are bad makeup on top of Erlang in many cases and you'd be better served just learning the Erlang way anyway.
- arrowsmith 3y ago> Phoenix in particular is an especially egregious example of a library that is badly made in almost every regard Can you elaborate on this? Why do you think this?
- 59nadir 3y agoThe interface to almost everything either contains or is based on a macro. This persists even in cases where you can clearly see there needed to be no macros at all. The non-standard (won't work with anything else) and basically superfluous websocket protocol has bad fundamentals and has been marred by bad JavaScript code being needed for it. On top of that it's pretty bloated. The actual channel processes could've simply followed a standard Erlang interface but someone (...) felt they needed to put their fingerprint on it, I guess, so it kind of doesn't. And yes, again everything surrounding channels is a bunch of macros until you at least get to write and use normal functions in the actual channel module. They've had a long history of arbitrarily deciding to hide settings/configuration from dependencies they use and having no actual argument for doing so when asked to expose them. If the part about macros being overused wasn't bad enough Phoenix also promotes this type of thinking by overusing them even in generated code, so people can follow the bad example.
- deleted 3y ago[deleted]
- coolros 3y agoThat was a good read, well done. I've been using Elixir for about a year now and I just smile when I'm coding. I'm still a little unsure about it's place and where it'll go, but I have loved exploring and learning BEAM with a little nicer syntax. Jose is great and watching the introduction of a type system is interesting too
- CyberDildonics 3y agoElixir seems to benchmark as half the speed of python, which would put it about 100x to 200x slower than C++. That's a lot of speed to give up for the silver bullet promise of immutable data structures (which I've never understood the appeal of in the first place). https://elixirforum.com/t/elixir-vs-python-performance-benchmarking/54260/3 https://elixirforum.com/t/elixir-vs-python-performance-bench...
- elcritch 3y agoIt's unclear why the techempower gives low performance for elixir / phoenix. But from what I've heard is that in real world applications the performance tends to scale much better than Python or Ruby.
- CyberDildonics 3y agoThe link is about execution speed, I think if you start talking about 'scale' that's a diversion, since that isn't about the language and is more about the architecture of the program.
- BaculumMeumEst 3y agoit's because the people who contribute to techempower benchmarks are zealots who believe that it's far more useful and important to show their One True Language in the Best Possible Light than to give you a useful benchmark. take a look at the source code for some of them and see for yourself.
- di4na 3y agoThese benchmarks have been thoroughly studied by the elixir community (even myself) and are... Trash. They compare things that have nothing to do with production, use non realistic code for most language and keep refusing PR to fix it for elixir. The community simply decided to stop trying to engage and let that code die.
- aeturnum 3y agoAlways glad to see another person finding their way to Elixir! IMO the biggest tripping point for people (including, clearly, this author) is the freedom. They said that the "Big complicated project structure" was a stumbling point - but there is no structure! You can actually do it any way you want. But there are conventions. Mix suggests that you lay our your project in a certain way (and most Elixir projects are laid out that way) - but you are not required to by the language. Nearly everything in the language is a convention (including the test / dev / prod run modes). This applies to Erlang as well. It has standard approaches, but you don't /have/ to follow them. I frequently get confused about the way libraries tend to approach something (do you have to do it this way? Is there a requirement?) and the answer is generally "no, but the community tends to think this is the best way to do it and so people generally do it this way." A great example of everything being a convention: structures aren't a language feature. They're maps with special keys and Elixir library support. The upside and downside to this is that you could actually do almost anything with them - if you have the time and the skill to implement the system. MANY things are like this when you get into it.
- bmitc 3y agoElixir, other than the language itself, has wonderful developer tooling that's all written and configured in the language itself. It makes me feel really comfortable because it's all right there. You don't need external scripting languages. For some programming, you don't even need external libraries sometimes. It all feels very OS like, not to mention the OS-like nature of the BEAM. If you're on the fence on Erlang or Elixir, watch The Soul of Erlang and Elixir by Sasa Juric: https://youtu.be/JvBT4XBdoUE https://youtu.be/JvBT4XBdoUE If it doesn't make you excited about a language, I don't know what will. It is an astounding feat that the Erlang team at Ericsson were so ahead of the curve and remain so today.
- macintux 3y agoI absolutely love Erlang. It’s a succinct, powerful, amazingly well-thought-out system design with a VM that is very complementary. I just can’t get past all the extra verbosity of Elixir, but this writeup gives me hope that someday I will.
- bmitc 3y agoErlang does have that nuts and bolts simplicity going for it, for sure. If it allowed rebinding on variable names and had pipelines, it would be very attractive to me. Elixir comes with a Ruby-esque syntax which I don't personally prefer, but I have gotten used to it. The built-in formatter helps out greatly there. I just go all in on Elixir module design just like I would in an ML dialect. So structs, module types, custom types, typespecs, docs, Credo turned up to 11, run Dialyzer, etc. So I embrace some of the verbosity. Some don't prefer the style, but those are all features already there, and for me, it helps bridge the gap for Elixir being dynamically typed. Although there are developments coming to give it a static type system.
- mcguire 3y ago"This is the root of my curmudgeoniness: Magic is never worth it. 99% of the time, Magic breaks. And when it does, and someone inevitably asks me to help fix it, I do it by getting out the machete and chopping out all the happy shiny convenient shit until you can see what is actually going on. And when you dig through the Magic and try to figure out what the hell is actually going on, most of the time it’s either stupid and broken by design, or it’s not very magical at all and you’re just like “why didn’t you just say this in the first place?” "Over and over again, it turns out that there is no such thing as Magic, and anyone who says otherwise is skimming over details that will bite you in the ass later on. This is fine for many purposes, because 90% of programs are small hacks and one-off tools and so “later” very seldom actually happens." Oh, yeah. This. So much this. A dump-truck load of this. Even better when everybody is using different Magic, or the guy who set up this Magic left two years ago and everything has been done my cargo-cult since.
- Dowwie 3y agoThings I like about Elixir: - concurrency is intuitive! - Elixir is a two-for-one language. You can reach into Erlang std library as easily as you can that of Elixir. So, depending on your work, you get a chance to discover a wide range of goodies that come for "free". Examples include gen_tcp, gb_tree, etc. - You can remote into a running virtual machine in production, pod or whatever, and have access to a repl that let's you inspect state, manage "processes", and manually invoke commands to troubleshoot issues. The observer, and tui counterpart, are quite useful too. - everyone in the community writing libraries uses the standard approach to emitting telemetry, saving time and effort for users to take what is available - fast compile times - hardest working BDFL (although this presents risks, too), who also has a pleasant, respectful disposition - the community is respectful Things I don't like: - dynamic language leads to pattern matching or type mismatch errors at runtime that could have been caught at compile time - Elixir Phoenix doesn't have a large community, nor much up to date reference material, or literature. If you're not experienced with Front-end dev, it's easier to onboard with a modern SPA framework like React. - supply of Elixir talent exceeds demand, although this isn't unique to Elixir (e.g Rust) - slowly growing ecosystem, relatively speaking
- OkayPhysicist 3y agoWhat the documentation for Elixir and its big libraries (Ecto and Phoenix) lack in quantity of documentation, they exceedingly make up for in quality of documentation. Who needs a bunch of garbage blog posts about how to do xyz, when the official docs painstakingly lay out not only what you need to know, but also present it in a readable and discoverable way?
- lolinder 3y agoI generally agree, but to play devil's advocate: some people learn better by example, and having thousands of (admittedly low quality) blog posts out there makes it more likely that someone will have done something very similar to what you're trying to do.
- pythonaut_16 3y agoIn my experience, the documentation is great for most of the major libraries and the common path. Once you get away from those things get sparse. Several really common libraries have glaring omissions (or entirely missing) module docs, and others just barely cover the common web use case. It’s not uncommon for me to have to open the source code to try and understand what some function actually does. Elixir is still my language of choice and has a better docs ecosystem than most languages but the community demonstrates a bit of a blind spot also.
- jnsaff2 3y agoIf you want to get a mindbending experience of the articles "it's macros all the way down" then here is one for you in glorious 3 minutes and 39 seconds: https://www.youtube.com/watch?v=x5W3CmZJMLs https://www.youtube.com/watch?v=x5W3CmZJMLs
- tommica 3y agoThat's pretty cool!
- plainOldText 3y agoThe syntactic sugar for the list of tuples (aka the Keyword list), such as: [one: 1, two: 2] instead of [{:one, 1}, {:two, 2}] and the other ... do: macros drove me crazy when I first learned Elixir. But as soon as I familiarized myself with it and a few other gotchas, Elixir managed to become my favorite and main language.
- ljm 3y agoI'm really enjoying getting to grips with Elixir, but I'm still really in two minds about Ecto having a macro-based SQL ORM. Like any ORM, the abstraction leaks, but it really throws you off course when you're trying to map the host syntax to raw SQL. from(t as SomeTable, where: x.z == ^y, join: x on assoc(t, :y)) Like, it's macro enough to make SQL feel more first-class...but not enough to actually make it first class, so you've gotta learn Ecto's quirks. It's also chainable so it's a macro over a query builder that eventually resolves to SQL at runtime.
- satvikpendem 3y agoElixir is cool, I used to use it for web app backends before adopting TypeScript and Rust. The reason I adopted them was the same reason I stopped using Elixir after a while: type safety. It was getting increasingly hard to be productive in Elixir in a large application due to runtime type errors that are caught in statically typed languages.
- cpursley 3y agoI've found that pattern matching in the function head and guards get you most of the way there.
- satvikpendem 3y agoYes however I get that in TS and Rust while also having stronger type guarantees. I don't think pattern matching is an alternative to static types, it's a supplement.
- weatherlight 3y agoRust, sure. Love me some Rust. Typescript's type system isn't sound and you can still get runtime errors. (Type systems should be bomb-proof or just get out of the way.)
- johnisgood 3y agoWell, I suppose to each their own. I use languages with and without static typing. I love Ada the most though, because the way you define types is very different from the most widespread way. In Ada, you define the range. Examples: type Day is (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday); subtype Business_Day is Day range Monday .. Friday; subtype Weekend_Day is Day range Saturday .. Sunday; subtype Dice_Throw is Integer range 1 .. 6; type Arr_Type is array (Integer range <>) of Character; type Color is (White, Red, Yellow, Green, Blue, Brown, Black); type Column is range 1 .. 72; type Table is array(1 .. 10) of Integer; type Device_Register is range 0 .. 2**5 - 1 with Size => 5; type Commands is (Off, On); type Commands2 is new Integer with Static_Predicate => Commands in 2 | 4;
- simmanian 3y agoIf I volunteer at a nonprofit and I'm trying to run a team of volunteers who would... 1) probably not stick around for long 2) need to be trained from scratch 3) not have a solid development background Would Phoenix be a good choice, given that you can do so much with it without needing to learn many other tools, or would it be better to start with something like Supabase + a javascript front end framework and hope we'll never have to deal with monsters like kubernetes?
- impulser_ 3y agoI would probably go with Javascript and Supabase, this would require you to only really worry about the frontend. Javascript is also probably easier to train people because of how many resources there are out there about training people to write Javascript. Supabase is also has a great free tier which will help your nonprofit. Hell, you might even want to try to contact them and they might give you a better tier for free they are really friendly there. Elixir is great, and developers love it but training new people without a solid development background might be hard.
- biorach 3y agophoenix does not sound like a good fit
- bhaney 3y ago> `if` is a macro. > `def` is a macro. > `defmodule` is a macro. > It’s all macros. It’s ALL MACROS! ALL THE WAY DOWN! AAAAAAAAAA AHAHAHAHAHHAHAAAA! Also see the definition for `defmacro`, the macro for defining macros, which is defined using... defmacro https://github.com/elixir-lang/elixir/blob/v1.15/lib/elixir/lib/kernel.ex#L5178 https://github.com/elixir-lang/elixir/blob/v1.15/lib/elixir/...
- pmarreck 3y agoIt looks like it got HackerNews'd. The stack seems to be Happstack, a Haskell lib. Perhaps if it was served by Phoenix... /obvious comment is obvious
- hu3 3y agoYou're correct. It says at the bottom: powered by https://github.com/jgm/gitit https://github.com/jgm/gitit Readme states that: "Gitit is a wiki program written in Haskell. It uses Happstack for the web server and pandoc for markup processing."
- rekoros 3y agoI usually just blindly upvote anything with Erlang/Elixir in the title, but this one I read in its entirety over some Pho Excellent writeup!