17 ms·
Elixir for Humans Who Know Python
- deleted 4y ago[deleted]
- meanmrmustard92 4y agoI like how programming language article/book title cliches are cross-pollinating now. In a decade, I hope we'll have "Bite size julia for morons who know how to stand on one leg and can read perl"
- jmrobles 4y agoNo typing, no party. ...but I will include it under almost-low-code section
- plainOldText 4y agoI've been programming my web projects exclusively in Elixir for the last few years and I've been deeply enjoying the language. Although at first, some unfamiliar design decisions annoyed me, for they were not well explained in the tutorials I was learning the language from – e.g `arg: value` as a shortcut for `[{:arg, value}]` in function arguments and other places – over time, I've grown to love and appreciate the language and I now more or less regard it as an elegant programming language put together by a thoughtful person with great programming taste. The Phoenix framework is a great bonus point if you want increased productivity for writing web apps. I don't miss Python at all. Elixir rests on the shoulders of giants though, and the Erlang/OTP is yet another elegantly engineered piece of technology, enabling one to develop concurrent, distributed and fault tolerant systems with ease, and in this regard I think the Erlang/Elixir ecosystem takes the crown. The actor model is simple, yet very powerful. For reference, I've also been learning Nim and F#, and they're also pretty unique and well designed languages in their own ways. I love Nim's fast compilation times, efficiency and expressiveness and F#'s powerful type system which enables one to develop domain models with ease. I've also been occasionally taking stabs at Rust, but it always feels just a tad too complex for my brain. I'll continue playing with it though, maybe it will eventually make sense. Ultimately, every design decision is also a tradeoff. I don't think we'll ever have a perfect, human designed language. My dream language would probably be a combination of Elixir and F# though, a language with an advanced and powerful type system, functional programming and the actor model as the building blocks. I guess fast compilation times à la Nim wouldn’t hurt either. :)
- mdm12 4y agoSounds like Gleam[0] would be up your alley :) As an F# guy myself, I am hoping it pans out, as I miss the BEAM platform! [0] https://gleam.run/ https://gleam.run/
- plainOldText 4y agoYeah, I've known about Gleam, but I don't recall exactly why I wasn't too compelled to use it. I installed it with brew a while back, I tried a few basic examples and since then it's just been sitting there. I guess I should revisit. But thanks for the reminder anyway.
- AlchemistCamp 4y ago> Although at first, some unfamiliar design decisions annoyed me, for they were not well explained in the tutorials I was learning the language from – e.g `arg: value` as a shortcut for `[{:arg, value}]` in function arguments and other places This complaint and a similar one for maps were the primary driver in me making an "Elixir tips" playlist of YT videos: https://www.youtube.com/watch?v=7w98voHko20&list=PLFhQVxlaKQEmO3gaork2WD5AY51LH3Ls0&index=13 https://www.youtube.com/watch?v=7w98voHko20&list=PLFhQVxlaKQ... What kinds of things have you been coding or reading in your Rust learning so far? I'm a pretty big fan of Herbert Wolverson's Pragprog Rust book and open source Roguelike project, as well as Tim McNamara's Rust in Action (which I've only gone through part of due to how each project leaves you wanting to keep building it after the book moves on to another).
- plainOldText 4y agoI wish I had this when I learned the language. :) I'll take a look, as your playlist is quite comprehensive it appears. Thanks for sharing! Re: Rust - I've been trying out basic examples, simple web servers, etc; nothing too fancy. But it just seems too ceremonious to get even the most basic things done. I own the book "Rust in Action", I just didn't have the proper time to go over it.
- 4y ago
- calo_star 4y agoOne thing I love about Elixir's syntax is that virtually everything is a call, take the if statement: if condition do IO.puts "true" :yes else IO.puts "false" :no end is just a call to the *Kernel.if/2* macro: if(true, do: (IO.puts("true"); :yes), else: (IO.puts("false"); :no)) I was joyous when I realized I could pipe stuff into a case statement.
- crabbone 4y agoAs someone who first came to Elixir from Erlang background, but also someone who has to work a lot with Python and hates every second of it... I'd need a completely different set of arguments. I don't like Ruby-like syntax. Not having something to separate expressions other than whitespace is a big turn-off for me. Something I also hate about Python. Something that a lot of forced Python programmers also see as a turn-off. Another, and perhaps superficial impression I got from Elixir is that it's Web-centric. I don't care about Web and have a strong distaste for everything that touches it. Python first appeared under the spotlight due to its Web framework, Zope, which kind of set the stage for that. Web had and still has a huge influence on how Python ecosystem developed, and that wasn't a good influence. I'd need an argument that says that Elixir is good outside of Web. I strongly believe that development speed is only in a very small part due to the language, and in a very big part due to how well you know the language. So, trying to convince me that the language is good because you could shave off a few minutes on a trivial task isn't going to convince me it's good. Working with large old programs is where productivity tools really matter because that where the bulk of my work goes to. But, really, I could never see the appeal of Elixir, when compared to Erlang. So, there's that. Also, I don't think it's worth it selling new technologies to Python programmers. Overwhelmingly, Python programmers are there either because it's popular and they like it, or because it's popular and they don't like it. Even in my first steps in Python world in early 2000's, I already knew there are better things than that. Quality was never a concern here, unfortunately.
- riezebos 4y agoShould @bulb_status be @bulb_on in the first line of the example in Templates? If not, does that mean that any variable that ends with _status gets an automated _on variable linked to it?
- olodus 4y agoI am part of the interest group "AI's who know Python" and together with "Aliens who know Python" we would like to file a complaint that this article is exclusionary for no good reason.
- shaundon 4y agoI've been using Elixir with Phoenix and Liveview at my job for the past three months as part of a small team building a non-trivial web app (https://duffel.com/links https://duffel.com/links). I'm mostly a front-end developer and was brought in to handle the UX side. Prior to this project I've spent the last 5+ years in the React world. I found a lot of what the author says to be true. I'm used to the nightmare that is managing front-end dependencies, and it was refreshing to use something so 'batteries included' that comes with most of what I need. It took me a while to get my head around the Phoenix + Liveview way of doing things, but when my mental model clicked into place and I stopped trying to do things the React way I became a lot more productive. When I had an autocomplete updating live as the user typed all going over the websocket without me writing any JS, it felt magical. However I definitely found a lot of sharp edges that the author doesn't mention. We struggled a lot with any non-trivial UX, for example with the autosuggest mentioned above I had to add a lot of JS to handle things like being able to use the keyboard's arrow keys to select options. Whenever I jumped into the JS world it often felt like I was fighting against Phoenix, and had to resort to using 'phx-ignore' a lot. It was frustrating to continually struggle to do things I knew how to do easily in a pure JS environment. Another area I struggled a lot is Elixir's syntax. To me, it feels like there are too many operators. The author touches upon it towards the end when they mention things like '\\' for default arguments, '<>' for joining strings and '++' for joining lists. It's a lot to wrap your head around at times. Some of the fault for this lies with me; we were working to a tight deadline so I didn't have time to dedicate to learning Elixir, Phoenix and Liveview from first principles, I just jumped in out of necessity. Had I spent more time on the foundations first I may have been able to avoid some of these pitfalls, but I do think it illustrates that like many 'do everything' frameworks, there's a steep learning curve to doing non-trivial things. It's a powerful tool and I'm optimistic about its future, but I'm undecided if I'd choose it for a future project that has significant front-end requirements at this stage.
- POiNTx 4y ago> Whenever I jumped into the JS world it often felt like I was fighting against Phoenix I've had the same experience and this is something I've tried to tackle recently. I've started working on LiveSvelte which allows you to plug in Svelte components directly into your LiveView, while still being able to push events to the server with a `pushEvent` function on the client. I've only started working on it this week but I think it's a promising idea. It's not React though but you could develop a similar package with React, I just much prefer Svelte :) https://github.com/woutdp/live_svelte https://github.com/woutdp/live_svelte
- revskill 4y agoI guess for 80% of useful use case, Javascript and NodeJS can do the job.
- jnsaff2 4y agoThey wrote there that they were looking at Elixir because they did not like the direction Python had taken. I'm sure Python can do the same as JS but Elixir is just so much nicer. Which is also my experience. Your point obviously stands, pretty much all of mentioned can do the job.
- PYTHONDJANGO 4y agoIs your comment based on experience with Elixir? How long did you work with Elixir professionally? I guess you have some fundamental experience with Elixir, as you would not post some comment here if not?
- revskill 4y agoYes, that's the point. Seriously i will not choose JS today if i have.a very specific requirements for choosing Elixir or Python (or any other stacks here). In reality, people choose the stack they're get used to. But it's their limited ability to see JS strength to solve their issue in first place. It's not informed choice.
- mikedelago 4y agoAt the very end of the day, I think some people just don't like JavaScript. At the risk of speaking for people other than myself, a lot of people don't want to write code in JS and if they don't have to, they won't. Frameworks/tools like Phoenix and HTMX or the fact that many languages can compile to javascript/wasm mirrors this opinion
- conradfr 4y agoAs someone who dislike the forced asynchronous nature of Node I would say Elixir is a better Node than Node ;) Most languages can do "80% of use cases" anyway.
- michaelteter 4y agoNo offense to TFA author, but I don't think this is doing to sell Elixir to Python people. In fact, I have serious doubts as to whether most Python lovers would be willing to set aside their beliefs and practices to learn the Elixir way. Perhaps Phoenix and LiveView will be the gateway drug, but even to reach that point requires a lot of effort to understand functional programming and Elixir. Python has some functional capabilities, but in my experiences with Python devs, those are little used and even shunned. Imperative, mutating loops are the Python way; and to suggest otherwise is to hear "But why would I need that? This (long functions with mutations everywhere and loops) is fine." I went from Ruby to Elixir, and even with my basic Clojure experience, it was an effort. It was worth it, but I think the apparently similarity of Elixir to Ruby is actually a negative. They look awefully similar, but their use is vastly different. As for Django vs Phoenix, I would argue that Phoenix has a much cleaner story for doing everything that Django can do and more. People promote Django for the "batteries included" aspect, which mostly just means "I get free user/auth system and built-in scaffolding for my CRUD." But those are things which are very easy to add to Phoenix (and Rails, which Phoenix is roughly similar to). Yet people choose Django for these little freebies which almost always get thrown away or ignored in real production worlds. For a quick proof-of-concept, it's nice. But for real projects it doesn't add value enough to offset the crufty boilerplate OO-centric code that results.
- bc58 4y agoI think I fall outside of the "most Python lovers" then. I love(ed) python for close to 20 years, and have written a ton in it as my main language. One project I worked on had us writing IronPython and IronRuby stuff (this was some years ago). I was forced to work on Ruby, and really hated it. Python, for me, was far superior. It really did not speak to me in any way. With that said, I started to look into Elixir 3-4 years ago, and it just clicked with me. In a short span of time I stopped developing anything new in Python, and now use Elixir as my go-to language of choice. I say this to say that it's worth the effort to at least expose people to new languages. It doesn't hurt anyone, and if other's aren't interested, they simply will not move to the new language. Others though might be pleasantly surprised to find out what other languages have to offer.
- 4y ago
- ak_111 4y agoWhat is the productivity advantage of Elixir/Phoenix over other frameworks when using it for implementing more mundane SaaS (some dashboards, some CRUD,...) rather than the game lobby feature mentioned in the post? I am a developer with significant non-web development experience (Although I know pure JS and Erlang quite well), who is interested in learning some full-stack development to implement a SaaS on the side and would like to zone in on the most productive framework possible.
- realusername 4y agoAs long as you don't have any dynamic part to your app, it's pretty much the same, it's the dynamic areas that are very very productive with live view. I've implemented a simple multiplayer card game in about a day for example.
- di4na 4y agoI would say probably on par. It is a bit less battery included but far far easier to adapt and far cleaner. The moment you need anything remotely dynamic, then the advantage is imho close to a 5x at least.
- dugmartin 4y agoFor me it's not just the framework (although that is nice) but really the VM that it runs under (BEAM/OTP). Running an app on the BEAM means removing the need for external servers like redis/memcache for cacheing and whatever queue management system you pick. For a SaaS app this means instead of trying to orchestrate a bunch of services via some complex system (k8s, etc) you run everything under one VM that both scales across both local CPU cores and distributed nodes in the same network easily. As for dashboards and CRUD UI that is improving in the latest Phoenix release. I have a 5 year old Phoenix app that I wrote that is still running in production and I generated all of the backend admin and most of the frontend using Phoenix's generators. However that did result in a lot of nearly duplicate view code. With 1.7's focus on shared common UI components the shear volume of template code is reduced, (but not eliminated). If I were you I'd wait for 1.7 to fully release and then try it out for a couple of hours and generate some simple app to get a feel for it. I've been programming professionally for 30+ years and I've written in a lot of languages and writing Elixir code just feels good. José Valim got a lot right with Elixir (and he sets a great tone - just read his comments in this very comment section).
- di4na 4y agoNote on Ecto: the macro based syntax was not exposed at first but ended being public API because everyone used it to be able to do pipelines and complex composition. I scarcely use it but it does clean up stuff sometimes.
- RobotToaster 4y agoAs opposed to pythons who know human?
- RandomWorker 4y agoAs someone that is deep into a Python web development, I see where this can be useful. However, after 1/3 down of the article it gets harder and harder to wrap my brain around the concepts without really learning elixir syntax. I feel like it would have been better to have 10 smaller articles than this long one, going deeper into the syntax and showing other example of Python way of doing it. I’m not sure I would do some of the example in Python as the author suggested. That case case it just build a string array and use join. To creat the statement with an eval to run it. Weird I know, but I’ve pulled that trick a couple of times now.
- Mizza 4y agoAuthor here. This blog post originally started out as just notes to myself as I was learning the language, so it's basically a brain-dump wrapped in a little prose to give people some exposure to the language. I still love Python, but I think Elixir is a great tool to have in the toolbox.
- RandomWorker 4y agoHi there commenter here. Thanks for writing the article, I will return on it maybe in a year or so. I started learning Clojure this year and it’s quite a journey. But functional programming is the future I’m convinced. Cheers.
- dgan 4y agoI was randomly watching youtube videos about Elixir ("The Soul of Erlang and Elixir " by Sasa Juric), and I have never really been interested in it... I was completely wrong. BEAM/Erlang is amazing piece of technology, and Elixir does excellent job to bring in new people in. If you do web development, then just for the sake of professional curiosity, I urge you to go watch a couple of videos to make yourself in idea. I have found that some (many) features which I would go learn and use another tool for, are already included into Elixir ... Now I feel sad for doing Django for my daywork
- Existenceblinks 4y ago5+ years elixir exp here, about to take python/django job. Why do you feel sad! I just gave up finding elixir jobs for a couple months.
- KyeRussell 4y agoI work for an org that does a lot of Elixir (on other teams though, I’m actually a Django developer!). I’ve heard from those team leads that they’ve had trouble hiring people with FP / Elixir experience, which is not that surprising to me. Guess it’s a matter of right place right time.
- Existenceblinks 4y agoYeah, right place, right time, knowing right people. I think it's close to impossible to go through from front door cold.
- bullfightonmars 4y agoMore orgs should hire experienced engineers and train them on the job.
- UlisesAC4 4y agoThis, a company to find skilled workers in a niche technology is expecting too much.
- Im-Batman 4y agoIs there an issue with the link?
- Mizza 4y agoWas tinkering, sorry, should be fixed now. I wrote this but didn't expect to see it on the top of HN on a Saturday morning..
- ralmidani 4y agoMy perhaps slightly biased input on Python vs. Elixir (I worked with Python for different projects for a couple years, and have been using Elixir full-time for ~1.5 years). Elixir as a core technology for application development (as opposed to data science/ML/AI - it’s still early days for Nx/Axon/etc.) is better than Python in just about every way that matters; e.g. immutability by default eliminating whole classes (no pun intended) of bugs, having the full power of OTP available if you need a distributed system, more convergence around libraries and frameworks (to the point that José Valim also works on Phoenix, LiveView, Nx, etc., not to mention having Mix, EEx, and ExUnit built in). I do wish Elixir had significant whitespace rather than do/end, but that’s not a hill I’m willing to die on… My one major gripe with Elixir’s ecosystem compared to Python’s is that, IMO, Django would have been a better source of inspiration for a dominant Web framework compared to Rails; Django’s model layer is top-notch, with all your basic model information for an app contained in one models.py file. In Rails and Phoenix, you don’t get auto-migrations out of the box for simple use cases, and your model layer ends up being distributed across schema/ActiveRecord files, a “structure.sql” or “schema.rb” file, and the migrations. In my real-world use, this has been… “sub-optimal” compared to Django, to the point that I sometimes dream about building my own Django-ish framework for Elixir. Django+Django REST Framework are that good - if you stick with Python and are not using them already, do yourself a favor and check them out. Also, Django’s admin is old, crusty tech, but it does what it set out to do really well. I will admit Django’s implicit queries can cause DB performance issues, I wish there was an explicit analogue to Ecto’s Repo.* functions to force devs to think about when to make the DB call.
- josevalim 4y agoIf you don’t mind, I have some questions as I would like to learn more. Are you aware of a large models.py for reference and learning purposes? Is it expected to define the schema of all my models in a single place but none of the logic? Also, don’t you run into scenarios in Django where the automatic migration is not enough and you need to provide custom commands? In such cases, how do you provide them? And can you have scenarios where you have two models pointing to the same table, but perhaps to a subset of fields (this is specially useful in read-only cases)? How is that handled? Thank you :)
- marhee 4y ago> The pipe operator, |>, passes the output of a function to the first argument of the next function. So, instead of writing something like: foo(bar(baz(new_function(other_function(my_input))))) You have the option to write: my_input |> other_function() |> new_function() |> baz() |> bar() |> foo() The readability benefit is clear - you don't have to read the code "backwards" to understand what it really does. —- (end of snippet) This is a nice example of fixing a problem that does not need be there at all. Just use intermediate variables instead of doing clever stuff. Benefits: - 1 way of doing stuff - variable names will help readers understand the intention of the function calls - you can do explicit error handling for each call Note: in contrast, in shell prompts the pipe operator is useful because: - less typing counts here - prompts are use-once mostly, maybe repeated (history & scripts), but readability is not a mayor concern - commands deal with large amount of data often, hence storing in intermediate variables can be expensive or even impossible. None of these points are valid for a programming language. (Unless of course you just fancy the syntax) Btw I find the joke about “bearded wizards” not very inclusive towards women. It feels assuming that only men (can) be that wizardry.
- UlisesAC4 4y agoIf you need temporal variables to give context you have other problems with the naming of the function that you are calling in the first place. We have used temporal names between function calls not because it was more readable but because chain of methods was not an option as you have said.
- josevalim 4y agoI would find such principled approach to be unproductive. The same could be said about Python, the `.` is equally syntax sugar for passing the object as first argument. So if we take this Pandas code: df.sort_values('dep_date') .groupby('name')['duration'] .transform('cumsum') If we were to pass df as first argument in nested calls, I would find it less readable. But I would also find using variables in this case to be more noise than helpful: sorted_df = df.sort_values('dep_date') grouped_duration_df = sorted_df.groupby('name')['duration'] grouped_duration_df.transform('cumsum') The variables are just repeating some of the information found on the right side and IMO they end up getting in the way of understanding the whole pipeline.
- Xzya 4y agoI have been working on a library for Django that allows you to build reusable template components, and it is heavily inspired by Phoenix's Components. I just released it today, so if you are a Django user and find the way that Phoenix Components work interesting, give it a try! https://github.com/Xzya/django-web-components https://github.com/Xzya/django-web-components
- spapas82 4y agoThis project is very similar to django components https://pypi.org/project/django-components/ https://pypi.org/project/django-components/
- linesinthesand 4y agoCould someone please write this same article but for GoLang
- fud101 4y agoI'm trying to decide between taking a Django job and an Elixir one. Can't decide between old and proven and new and early adopter. Any advice?
- jjtheblunt 4y agoElixir : mind expanding -> skills expanding
- elephanlemon 4y agoHave you written a functional language before professionally? If not, I’d lean towards Elixir as a way to expand. Can always go back to Python later.
- yurishimo 4y agoPersonally, I would take the Elixir job. Especially if you already know Python and have been employed previously. You'll learn a totally new way of thinking about problems. Many Elixir jobs are also aware that most people don't know Elixir, so you'll have plenty of time to learn on the job with plenty of support.
- 8s2ngy 4y agoI am in a similar situation as well. The company at which I am working as a trainee engineer has a small team dedicated to Elixir and Phoenix. I have a choice between Ruby with Rails and Elixir with Phoenix after I am done with my training. Elixir intrigues me because it is so different from the programming I learned at college, but I am also anxious about shoehorning my initial work experience into a niche technology that might be difficult to find a job in, a few years down the line.
- fud101 4y agoYeah, it's a big trade off careerwise, i'd have to go with Django also. I have the lisp disease of wanting a magic bullet when none exists.
- xutopia 4y agoElixir will present you new concepts that you will be unfamiliar with and the development experience is actually really fun! For becoming a better programmer long term I would go for an Elixir experience early on.
- l_theanine 4y agoLiveView can’t handle spotty connections, I thought? Career python expert, not huge into Django/we dev in general… I thought the whole thing with most HTML over the wire is that its tied to the connection latency? Unless there’s some js component underlying the Elixir code that I don’t know or don’t understand. With the advent of things like flask+html, I find it a little hard to believe that Elixir hackers could whip up a MVP faster than I’ve seen it done with flask. I’m not opposed to functional programming by any means, but just because the language embraces it doesn’t qualify all the constituent frameworks to replace world-class solutions like Django.
- freedomben 4y ago> LiveView can’t handle spotty connections, I thought? LiveView handles it just fine. If the websocket disconnects for some reason it will automatically re-establish itself when the connection is restored. You can also use the built-in JS module to do client-side things when you don't need backend support. I use Alpine.js (PETAL stack) and I like it a lot. If you have a very complex client-side need, it's also pretty easy to use React.js for that. > With the advent of things like flask+html, I find it a little hard to believe that Elixir hackers could whip up a MVP faster than I’ve seen it done with flask. You'll have to get more specific if you want an accurate answer. Does this MVP require a database? Does it require specific UI or can you just massage the OOtB UI that Phoenix gives you? You'd be surprised at how much of a headstart the generators can provide. I've built working protoypes (with database persistence) in 30 minutes. If it's purely a static page, I would just use nginx directly but you could easily do that in Phoenix as well in about the time it takes you to write the HTML since the default new project comes with a page controller already set up for that.
- enraged_camel 4y ago>> LiveView handles it just fine. If the websocket disconnects for some reason it will automatically re-establish itself when the connection is restored. What the parent means is that, because state is kept on the server with LiveView, and events that change that state are processed by the server, if your connection is lost, then you may find that even basic things, such as having a dialog open when you click a button, stop working. This means that unstable connections result in very poor UX. This is in direct contrast to a typical SPA for example, where the browser keeps and handles most front-end state, and talks to the server only when it needs to (e.g. form submission).
- submeta 4y agoI love functional programming because it feels natural to me to have functions that always return a value (method chaining or postfix notation FTW!) do not mutate data (and therefore avoid side effects), and use clear naming conventions for any potentially destructive functions. However, Python's popularity, vast library, and strong community make it a more practical choice for solving problems - at least when programming is not my primary focus but rather a means to an end. While I find Clojure, Elixir, and F# attractive, it doesn't make sense to use them for anything more than experimenting or playing around, given the resources available in Python.
- pg_1234 4y agoAs a Python programmer, I truly believe Elixir/Phoenix is the best stack out there from a technical perspective. However the incredible breadth of libs and resources ... and most importantly the mind share (both available devs, but more importantly available jobs for seniors who commit to Elixir) means that it is still just not a competitive choice. Almost all commercial software dev is not about technical excellence, but rather about applying the available tech to a particular business domain. And there Python (and .Net, Java, PHP, Ruby ... even Go) are so far ahead that sadly Elixir doesn't look like it will make it.
- submeta 4y ago> Almost all commercial software dev is not about technical excellence, but rather about applying the available tech to a particular business domain A manager focused on results will not make decisions based on beauty or excellence, unfortunately, but based on other criteria: What gets the job done, availability of resources, price. That’s why PHP is still the most used programming language in web dev in Germany (instead of Ruby/Rails or Python/Django), and Excel is the most used tool for data analysis in the business world (instead of Python + Pandas).
- josevalim 4y agoI guess it really depends on your definition of "make it". :) Elixir today is used by startups, unicorns, fortune 500, and at least two of the FAANG (for whatever it is worth). It is used for web apps, embedded, distributed systems, data processing, and making inroads on AI and machine learning. It has a vibrant community with events around the world, several dozens books, and more. It is on the [top quadrant of Redmonk][0] and [top 25 on most GitHub language stats][1] while being the second youngest language there (only older than Swift which was created by Apple). Considering it is a language standing on the shoulder of giants but started by a 30-person company, I would say we definitely made it (I am obviously biased!). Of course there is _a lot_ to improve, realistically speaking it is unlikely we will cross top 10 (maybe that's your definition of "make it") but I also want to be clear that we will be here for quite a while! 0: https://redmonk.com/sogrady/2022/10/20/language-rankings-6-22/ 1: https://madnight.github.io/githut/#/pull_requests/2022/4
- Spivak 4y agoAssuming the author is in the comments, the paragraph about data immutability is wrong. Integers are immutable in Python, when you created the lambda the name x is in its closure. When you assign to it it changes where the name is pointing to. Elixir does something wild and completely different. When you assign x that second time at that moment is creates a new variable behind the scenes and you transparently start using that one when you now refer to x in that scope. So lambda has a reference to x@0 and your outer scope has a reference to x@1.
- otreblatercero 4y agoThanks for pointing that out, I knew it was a closure because of the Elixir in Action book, and the example's explanation threw me off balance.
- Timothycquinn 4y agoInteresting article. Having the built in Redis via ETS is slick. I currently use Python but don't use Django but instead wrote my own WSGI frameworks based on Flask Restx. I'm not a big believer of ORMs besides their CRUD functionality so there is not much benefit for me using Django and the security burden it carries (like PHP) by being so popular. I can keep my designs light weight, very secure and fast; albeit not nearly as fast as Phoenix. Note however, I don't build public facing high performance applications so its not critical to have max IO like that which Phoenix can handle. In a way, I wished I had moved to Elixir but with the technical debt invested in Python its a very big jump. Maybe someday down the road...
- spapas82 4y ago> Interesting article. Having the built in Redis via ETS is slick. This isn't really true. Although having a built in redis may be possible, the fact is that production elixir projects do use redis on a lot of cases (for example as a task queue). ETS is rarely used because of its complexity.
- sph 4y agoRedis might have a nicer API but the ops of maintaining another service is not simpler than just using ETS that is built in the platform. I'd rather choose Redis only iff I hit the limits of ETS. And 99% of apps won't even get to that point.
- Scubabear68 4y agoI haven’t gotten through the whole article yet, and haven’t encountered Elixir before, but I really like the popes ideas. I am going to dig into that a little more. Are there other languages that have similar constructs (outside of shells!)?
- sodapopcan 4y agoOcaml, F#, probably others.
- Scubabear68 4y agoThanks!
- sodapopcan 4y agonooooo prob! :)
- sodapopcan 4y agoPS, if you're still watching this space: Clojure is an obvious one. It's called the "thread" operator and is a bit more flexible in that you can thread into the first argument (->) or the last (->>). This definitely works for Clojure and whether or not this is a good idea in other languages could be debated ad-nauseam.