5 ms·
I really want to like Erlang because the priorities and USP's of the language are super compelling for a lot of use-cases. I tried to kick the tires on it a co
by skohan 6y ago
I really want to like Erlang because the priorities and USP's of the language are super compelling for a lot of use-cases. I tried to kick the tires on it a couple years ago, and what I found is that the error messages were just so vexing, and it took a minute to understand what they meant, even in toy examples. Maybe it gets better with time, or there is tooling to help with this, but it seemed a bit behind the times with the standard which has been set by more modern programming languages.
- cpursley 6y agoGive Elixir a spin.
- deleted 6y ago[deleted]
- dognotdog 6y agoI'd second that, Elixir does away with the sometimes vexing comma and dot syntax used for scoping. Also, it does have mutable variables. You do have to get to grips with pattern matching and processes as objects being such core concepts, but I found that once I got it, it is wonderful.
- dnautics 6y agoJust to clarify: Values in elixir are still immutable. The core team will insist that variables are immutable but bindings are mutable, but in my mind variables are their bindings (there is not a third category distinct from the value and the lexical binding). I think there is huge debate as to whether this is good or bad - I think though you really really want to have mutable variables in the REPL. In your static code it's trivial to check for variable rebinding and be sure you're not doing it (credo makes this easy to set up)
- wtetzner 6y agoVariables in Elixir are not mutable, they can just be rebound. Think 'let' in Scheme or ML.
- dnautics 6y ago> in my mind variables are their bindings (there is not a third category distinct from the value and the lexical binding)
- wtetzner 6y agoI was responding to this: > The core team will insist that variables are immutable but bindings are mutable The documentation on the Elixir website refers to it as rebinding, and I don't see any references to bindings being considered mutable. Rebinding means you've created a new binding with the same name. The original isn't being mutated, it's just not accessible anymore because of the scoping rules.
- dnautics 6y agoMy point is I don't know what that means. The variable is the binding changing the binding by throwing away the old one is not distinct from mutating it because the binding "isn't a real thing, just conceptual", just as the variable isn't "a real thing"; unlike a value which is actually a thing sitting in a memory slot in your vm. If you can give me an example of where there is a meaningful distinction between the variable and its lexical binding I am happy to be enlightened.
- lfischer 6y agoI believe an example of where binding differs from assignment is if you define a function which references a binding in the outer scope, the create a new binding with the same name in the outer scope, the value inside the function does not change: a = 1 f = fn -> a end f.() # returns 1 a = 2 f.() # still returns 1
- 6y ago
- macintux 6y agoThe scoping punctuation is very easy if you think about it. I begrudgingly accept “I don’t like the syntax” as a reason to not use Erlang, but there’s nothing challenging about it. It’s a much smaller syntax than Elixir. The punctuation rules are very similar to English: comma means you’re not through with your thought yet, semi-colon means you’re introducing a new clause, period means you’re done with the entire thought.
- spinningslate 6y ago>The punctuation rules are very similar to English: comma means you’re not through with your thought yet, semi-colon means you’re introducing a new clause, period means you’re done with the entire thought. Agree, at least when looking at code statically. It's a bit of an inconvenience when editing though. For example, re-ordering lines in a function / adding a new line to the end. That leaves a full stop at the end of an intermediate line and/or a semi-colon at the end. Compiling/running that without fixing (assuming you didn't spot it) can lead to cryptic compiler errors. I find this hits me a surprisingly large number of times. Maybe it's just the way I write code. But it is an annoyance (for me anyway). To be fair, any decent editor/IDE will highlight the error. None that I'm aware of has an auto-correct though. It's a minor annoyance in the great scheme of things. Erlang remains one of my favourite languages. Writing REST services as OTP applications on top of Cowboy* is a very rewarding experience and generates rock-solid, highly scalable, production-quality binaries. *Webmachine was even better though sadly now not actively maintained.
- bcrosby95 6y agoIf your problem is errors then Elixir can still be pretty confusing, especially with respect to things like GenServer.
- ramchip 6y agoIt's true it can feel cryptic at times. The good news is improving error messages and ease of use is a major focus area in next year's release. This PR from a few days ago looks like a very nice improvement in that direction: https://github.com/erlang/otp/pull/2849 https://github.com/erlang/otp/pull/2849
- the_only_law 6y agoIve had so many projects I've wanted to use erlang with because it seems a nearly perfect choice until I do more research. I really miss things like the bitstring syntax when stuck working in most other things.