TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Switching to Elixir

336 点作者 orlandohill超过 1 年前

36 条评论

zoogeny超过 1 年前
I have been watching Elixir YouTube videos pretty much every day for the last few weeks. I guess there was an Elixir conference recently and after I watched a couple, YouTube has been sending me a consistent stream of Elixir content.<p>I really want to try out this language. I love the idea of Erlang but the few times I&#x27;ve had to deal with it (an ejabberd chat server was one) I found it to be a bit too quirky. Every video I&#x27;ve seen with Joe Armstrong leads me to believe he was an under-appreciated genius. Isolated processes and message passing (Actors) seem a good candidate for the future of distributed programming (see this recent video from Crockford on his new Misty programming language [1] - notice how the questions were about Elixir&#x2F;Erlang). I love pattern matching and elixir uses this to a high degree.<p>However, I am not 100% sold. Clearly this community punches above its weight, and the BEAM is obviously no slouch and is a brilliant choice for a platform to build upon. But I get concerned looking at the magic of LiveView (and LiveBook). My experience is that if something sounds too good to be true, it often is. A lot of the jargon is also totally unfamiliar to me - things like GenServers and other esoteric kinds of platform specific knowledge. It feels like stepping into a one-way portal, I&#x27;m not sure any knowledge in that universe is transferable.<p>There is a huge risk in niche languages and platforms. Hard to hire for, hard to find libraries for, hard to find blogs&#x2F;tutorials&#x2F;etc. With alternatives like Go having a pretty respectable concurrency story ... it is pretty hard to justify taking the risk on such a small community.<p>But kudos to that community. It is honestly impressive to me what they have achieved. I&#x27;m also very excited to see what happens with their type system implementation.<p>1. <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=R2idkNdKqpQ">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=R2idkNdKqpQ</a>
评论 #38215778 未加载
评论 #38215799 未加载
评论 #38215773 未加载
评论 #38215740 未加载
评论 #38215547 未加载
评论 #38217525 未加载
评论 #38217281 未加载
评论 #38224993 未加载
评论 #38217956 未加载
评论 #38226616 未加载
superdisk超过 1 年前
For me the big sell of Elixir&#x2F;Erlang is that it makes running &quot;background jobs&quot; a complete breeze with no concern for blocking IO bringing the entire server to a halt, especially in a web server context.<p>At my last job I had to do a bunch of HTTP requests in a webhook handler and if enough happened at once, the entire site would just crash due to all the OS processes being busy. I found myself desperately wishing I was just using Elixir instead because it would have been trivial to just spin up a Task to do it and move on.
评论 #38215061 未加载
评论 #38215230 未加载
alskdj21超过 1 年前
Sasa Juric&#x27;s <i>The Soul of Erlang and Elixir</i> talk[1] showcases how powerful the language can be.<p>[1] <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=JvBT4XBdoUE&amp;t=4">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=JvBT4XBdoUE&amp;t=4</a>
评论 #38218511 未加载
runegustavsson超过 1 年前
I&#x27;ve been programming in Erlang since 1991, every day; and that has been my intention all the time. I&#x27;ve done things in Haskell, Rust, Elixir, etc.. over the years. Strong typing is extremely valuable but what it all boils down to is where I have the most fun. Erlang is the prog.lang that gives me most joy and I plan to continue hacking Erlang, at least, until I retire in a few years.
评论 #38220953 未加载
isodev超过 1 年前
I only learned about Elixir a little more than a year ago and it’s been a lot of fun to learn and incorporate in different components.<p>My biggest joy comes from how much one can do out of the box with beam&#x2F;otp. Someone in a team I worked with once said “BEAM&#x2F;OTP is like k8s only without the complicated parts”.
评论 #38215256 未加载
gigatexal超过 1 年前
“In fact, I might go as far as saying that Elixir gives you a fun language (like Ruby) while leaving out the stateful footguns OOP languages give you. There are no classes, no instances, no inheritance…it&#x27;s immutable and functional and you&#x27;re not bogged down by a static type system.”<p>I want this but with types. I’m convinced strongly typed is the way to go for larger code bases as it hides the magic of a lot of things and is easier to reason about.
评论 #38215221 未加载
评论 #38215194 未加载
评论 #38215692 未加载
评论 #38215455 未加载
BMorearty超过 1 年前
&gt; In Ruby it&#x27;s common to use exceptions for control flow.<p>I think this is just plain incorrect. The example given later in this paragraph is the Rails `update` method--but the approach used in all canonical Rails examples and generators is the non-exception version of `update`.
评论 #38234270 未加载
评论 #38215744 未加载
评论 #38215313 未加载
sinuhe69超过 1 年前
Coming from F# and only dabbled in Elixir, I find the language unfortunately a bit confusing. For instance, the signature of a function only reveals the name and number of the parameters but not type, so in a big library, it’s quite hard to recognize (mentally) what goes into what and one can only see one plugged the wrong parameters after one had ran and debugged the code. In strict-type language like F#, such issues would be detected right away during coding, thus it helps to reduce the time and effort immensely.<p>So my question is what are the main selling points of Elixir besides the Erlang environment?
评论 #38215120 未加载
评论 #38215155 未加载
评论 #38215119 未加载
评论 #38215770 未加载
评论 #38216347 未加载
aryehof超过 1 年前
Write after you’ve been there for 2 years, instead of at the start. That new thing always looks like a flawless shiny new silver bullet when starting out.
评论 #38234331 未加载
评论 #38215607 未加载
99miles超过 1 年前
I&#x27;ve been using Ruby since about 2007. Every time I attempt to switch to the next &quot;cool&quot; thing, I ended up switching back, because Ruby is what I love and am the fastest with, and that&#x27;s all that matters.<p>However, I&#x27;ve been starting to see a lot more Elixir buzz, and I love the looks and sounds of it. Looks like I&#x27;ll need to start a new side project soon to give it a try.
bdavid21wnec超过 1 年前
I used Elixir briefly, what sticks out to me was how easy it was to learn. Really like the pattern matching and immutable data. What it excelled at most and I still haven’t found the full equivalent in any other language is building a full CQRS system. The Commanded library combined with graphql was so powerful and well thought out. With the BEAM if a developer writes some bad code, instead of screwing up all your events, the GenServer will just error out on the same event until new code it pushes to fix it. Events will starting queueing, but the whole system is unaffected. It was brilliant
whalesalad超过 1 年前
The true power of Elixir comes from processes and OTP.
评论 #38219797 未加载
da39a3ee超过 1 年前
&gt; There are no classes, no instances, no inheritance<p>I don&#x27;t know anything about Elixir, but it bothers me when people claim that languages like Rust and Go are &quot;not object oriented&quot;. If you create structs and have special syntax for defining functions that operate on instances of those structs, then those are called objects and you are doing OOP. Just because some Java people came up with a definition of OOP that says it has to have inheritance, doesn&#x27;t mean you actually have to pay attention to their definition.
评论 #38216396 未加载
评论 #38218628 未加载
ThinkBeat超过 1 年前
I love BEAM since I was first introduced to Erlang. I think it should be adopted a lot more for codebases and that it solves a lot of problems in a good way that are currently solved in bad ways in modern trends.<p>Clearly there are strong preferences among folks for static or dynamic typing, almost like vi vs emacs.<p>My opinion is on typing is:<p>Stating typing does not slow you down.<p>With dynamic typing while you are writing code you have to plan and remember what type a variable of some sort represents before You can act on it.<p>With static languages most type of variables will be known at compile time and can offer good feedback if a type is used in the wrong manner. It also makes it much easier to know what a variable is and what it might be doing if it has an official type.<p>Reading dynamic code I often have to search around a bit to figure out what a variable is.<p>I think if the only reason it is &quot;problematic&quot; to have static typing is because writing &quot;int&quot;, &quot;string&quot; etc. is too much work then your priorities are mixed up.<p>Sometimes people resort to Hungarian notation to help out. (Less and less) sName,iAge,etc. That is helpful but you might as well have static typing at that point.<p>There has been a lot of work done to find a good way to add (optional) static typing to Elixir and I think it is on going but represents a hard problem.<p>I am glad Gleam is out (<a href="https:&#x2F;&#x2F;gleam.run&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;gleam.run&#x2F;</a>), it is my favorite BEAM language now.
ctrlmeta超过 1 年前
&gt; A few months ago I started a new job at a company that uses Elixir<p>&gt; In fact, I might go as far as saying that Elixir gives you a fun language (like Ruby) while leaving out the stateful footguns OOP languages give you.<p>I don&#x27;t mean to discount the author&#x27;s experiences and opinion in this post. It&#x27;s a nice post with a lot of good food for thought. Likewise I want to share only my own experience here. Two months into any new programming language, it feels like a fun language. Eventually the novelty factor wears off. And then it becomes a boring language. And I say &quot;boring&quot; in a positive sense.<p>The daily driver languages should be boring. Should present no surprises. Get the job done and get out of my way. When we transistion from the fun phase to that boring phase, what matters more is how good the language is fundamentally designed. As an example in Elixir the pattern matching abilities are great but I don&#x27;t know if I could justify choosing a language without compile-time type safety in this day and age!
danjac超过 1 年前
It would be nice to work with Elixir, having played around with it.<p>However every Elixir job I&#x27;ve seen requires Elixir experience, so I don&#x27;t really see much opportunity for working with it professionally.
评论 #38216972 未加载
linkdd超过 1 年前
Self promotion moment:<p>If you enjoy the Result&#x2F;Either type and API in Rust, I made this project just for this: <a href="https:&#x2F;&#x2F;github.com&#x2F;linkdd&#x2F;rustic_result">https:&#x2F;&#x2F;github.com&#x2F;linkdd&#x2F;rustic_result</a><p>I also made <a href="https:&#x2F;&#x2F;github.com&#x2F;linkdd&#x2F;rustic_maybe&#x2F;tree&#x2F;main">https:&#x2F;&#x2F;github.com&#x2F;linkdd&#x2F;rustic_maybe&#x2F;tree&#x2F;main</a> for an Option&#x2F;Maybe type.<p>NB: Those are not types, but I&#x27;m waiting for set theoretic types to update those libs :)
gaws超过 1 年前
&gt; A few months ago I started a new job at a company that uses Elixir as its main language on the backend.<p>&gt; I&#x27;ve never written a line of Elixir or Erlang before in my life<p>Isn&#x27;t this a red flag to the recruiters and hiring managers?
EMM_386超过 1 年前
&gt; you&#x27;re not bogged down by a static type system<p>Maybe it&#x27;s just me, and I&#x27;m not even specifically referring to this particular post ... but why is there so much &quot;debate and discussion&quot; (flamewars?) over static typing recently?<p>I am guessing this is due to a large influx of people into IT, many of whom got hired because they knew some JavaScript, &quot;React a plus&quot; a lot out of bootcamps and similar programs. As that sizable group ran headlong into static typing, usually via TypeScript, then the debates began.<p>All over Reddit, Twitter, even HN. People insisting that the verbose and confusing syntax was a &quot;bridge-too-far&quot; and one they would not cross, even if the reasons came down to &quot;it looks weird&quot; or &quot;don&#x27;t have to &#x27;compile&#x27; JavaScript&quot;.<p>Maybe, spending too much heads-down time over the last ... whatever decades at this point ... I simply don&#x27;t get it.<p>Don&#x27;t get it similar to what I quoted here ... &quot;bogged down by a static type system&quot;. &quot;Bogged down&quot;, in what way?<p>I spend my days mixed between everything from C# to JavaScript, almost polar opposites. And the rest of it usually in TypeScript.<p>I do not get this feeling of being &quot;bogged down&quot; by static typing .... ever? I don&#x27;t recall it being an issue, even though I spent hours in statically typed lanagues yesterday alone. Maybe if you are the author of a complex JS library that has to be shoe-horned into TypeScript ... yes, maybe.<p>What I <i>did</i> experience recently was being able to remove a parameter from a function, actually compile with the intent it will fail, see it fail, double click on some things and fix the 17 callers to that method I just changed the signature of, and then a minute or so later after fixing those call sites, I was back to work.<p>Yet, over on the social sites, the debate rages on. Open source projects removing TypeScript practically overnight for &quot;reasons&quot;. Questions such as &quot;how many type issues did you run into before switching to TypeScript&quot;, leaving me to wonder if that is even a rational question.<p>And then on the flipside, &quot;TypeScript is the greatest language ever&quot;, heart emojis being sent to it, &quot;If you are a JS dev you need to be using TS&quot;.<p>It&#x27;s all strange to me, having used JavaScript for the first time back in 1996.<p>I&#x27;m convinced it was this wave of JavaScript devs crashing into new requirements to use TypeScript that started it.<p>It will sort itself out here at some point.
cheema33超过 1 年前
How do people switch programming languages? Established languages have massive ecosystems. Large set of libraries. For example, I cannot give up MS Entity Framework Core or Hot Chocolate graphql server for C#. Sure, there are alternatives, but nothing as feature complete.<p>Perhaps it is possible for applications that have small set of requirements.
评论 #38214958 未加载
评论 #38215093 未加载
评论 #38215017 未加载
评论 #38214951 未加载
评论 #38216384 未加载
评论 #38214925 未加载
评论 #38215154 未加载
gv83超过 1 年前
while bracing myself for the downvotes storm: why is this frontpage? it&#x27;s very bland content harping the same old story about immutable data and pipes, without any real insights other than &quot;3 months of a new thing and it seems cool&quot;.<p>are we really at the point where rust or elixir in the title = instant karma shower?
评论 #38234361 未加载
rednafi超过 1 年前
I usually pick up languages that allows me to write and ship high quality CLIs quickly. Over the years, I’ve written and shipped a few. If a language comes up with a VM where the CLI startup time is too long, it’s a show stopper for me. I know, weird requirement.
hbcondo714超过 1 年前
&gt; Elixir&#x27;s |&gt;, and it inserts the result of the previous expression into the first argument of the next function<p>I found this convenient while writing my first Elixir app with Phoenix Liveview:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;hbcondo&#x2F;last10k_liveview">https:&#x2F;&#x2F;github.com&#x2F;hbcondo&#x2F;last10k_liveview</a>
jononomo超过 1 年前
I love Elixir.
michaelcampbell超过 1 年前
&gt; Exceptions, then! In Ruby it&#x27;s common to use exceptions for control flow.<p>&quot;common&quot;? Not IME. Certainly possible, but I don&#x27;t see it a WHOLE lot. Maybe it&#x27;s just $CURRENTJOB&#x27;s style not to, I&#x27;ll grant.
sBqQu3U0wH超过 1 年前
&gt;A few months ago I started a new job at a company that uses Elixir as its main language<p>&gt;I&#x27;ve never written a line of Elixir or Erlang before in my life<p>How is this possible?
评论 #38221116 未加载
评论 #38217946 未加载
评论 #38219142 未加载
评论 #38219164 未加载
andsbf超过 1 年前
`...If you call model.update(params) in Ruby, then it returns false if it fails and updates model.errors with what went wrong. Mutable state.`<p>This is Rails stuff, not Ruby
评论 #38215063 未加载
评论 #38234398 未加载
colesantiago超过 1 年前
Which companies have used Elixir in production, I know Brex used to use Elixir but now used Kotlin and also the Bleacher Report.<p>Are there any more?
评论 #38215370 未加载
评论 #38215095 未加载
评论 #38216586 未加载
评论 #38219913 未加载
评论 #38217773 未加载
评论 #38215112 未加载
jononomo超过 1 年前
Elixir may not be statically typed, but at least it isn’t object-oriented.
评论 #38219130 未加载
readline_prompt超过 1 年前
understandably types are great, but the projects I&#x27;ve worked in got along just fine using specs and dialyzer&#x27;s success typing. of course sometimes it can get messy like in macros etc.
pmarreck超过 1 年前
FYI it&#x27;s spelled &quot;cinch&quot;, not &quot;synch&quot;
fyokdrigd超过 1 年前
elixir is awful, mid-long term.<p>you write mix new something. it generates tons of code which will NEVER be update when the template gets update for new people running mix new something.<p>then all the liveview magic happens with JavaScript code writen by someone who will not be there when major browser security model changes happen (and google make sure these happens every 3mo). then who will keep updating the magic js?
评论 #38219194 未加载
xonetons018超过 1 年前
Cone tond
byhemechi超过 1 年前
I often see people say static typing slows them down and I&#x27;d really like to know why that is because for me it&#x27;s the exact opposite, I really don&#x27;t like not knowing what format data is in. I&#x27;d much rather have to write slightly more verbose code and have a vast number of possible errors caught at compile time instead of having things go wrong in production when someone inputs something a bit weird with nothing so much as an error.
评论 #38215922 未加载
评论 #38216529 未加载
评论 #38220753 未加载
评论 #38215394 未加载
评论 #38218001 未加载
评论 #38218959 未加载
评论 #38219311 未加载
评论 #38215276 未加载
评论 #38215262 未加载
评论 #38217137 未加载
评论 #38216098 未加载
评论 #38216898 未加载
评论 #38216104 未加载
评论 #38215988 未加载
评论 #38217502 未加载
评论 #38218594 未加载
评论 #38216297 未加载
评论 #38219714 未加载
评论 #38217337 未加载
评论 #38217881 未加载
评论 #38215228 未加载
评论 #38216642 未加载
评论 #38215222 未加载
评论 #38234302 未加载
评论 #38221287 未加载
hartator超过 1 年前
And still 0 successful startup has been built on top of elixir.
评论 #38215613 未加载
评论 #38215805 未加载
评论 #38216375 未加载
评论 #38215265 未加载
评论 #38219163 未加载
评论 #38219943 未加载
评论 #38215550 未加载
block_dagger超过 1 年前
Longtime Rubyist here that has worked with Elixir. It is only loosely based on Ruby&#x27;s syntax - there is a _lot_ more punctuation in Elixir. Also much more explicit passing of parameters, including database connections and error handlers in the case of a Phoenix application. It&#x27;s also a challenge to deploy OTP along other non-hypervised runtimes. BEAM and Elixir are very cool, don&#x27;t get me wrong, but after some programming web services in Elixir I was ready to head back to Ruby. If I need a highly fault tolerant near realtime comms system, I&#x27;ll look at Elixir, otherwise I avoid.
评论 #38215140 未加载
评论 #38214960 未加载