Live data from Hacker News

Flirting with Elixir

eng.localytics.com

11–20 of 29 posts

Re: Flirting with Elixir

#11
post #2

I've been "obsessed" with Elixir lately, and it truly is a breath of fresh air in the current programming language landscape. I've started with C, built a career with backend Python services/dashboards, and spent some time on the "fringe" learning about Lisp, Scheme, Haskell, Clojure. And once you rewire your brain with functional programming constructs or immutability, it is really hard to go back to Python, using l…

Haskell without purity and types I'm getting quite tired of this "Every functional language I can't precisely describe is like Haskell" sentiment. It's the "tastes like chicken" of programming languages. Then again, the original article is remarkably devoid of content, so I suppose it's only fitting. Interestingly, avoidance of excessive magic is a large reason why I stick to vanilla Erlang.

I agree that the comparison with Haskell is ill fitting.

The sentiment I wanted to express is that Elixir, like Haskell, is built around function (or module) composition, is immutable, and state is idiomatically handled separately (with separate processes and message passing, instead of monads).

Re: Flirting with Elixir

#12
post #4

I can highly recommend David Thomas' book Programming Elixir, I found it complete to get a good grip and also a great introduction into functional programming overall https://pragprog.com/book/elixir/programming-elixir

Just got the confirmation that Programming Elixir and Metaprogramming Elixir shipped. They can't get here fast enough.

Re: Flirting with Elixir

#13

Earlier quoted context omitted.

Haskell without purity and types I'm getting quite tired of this "Every functional language I can't precisely describe is like Haskell" sentiment. It's the "tastes like chicken" of programming languages. Then again, the original article is remarkably devoid of content, so I suppose it's only fitting. Interestingly, avoidance of excessive magic is a large reason why I stick to vanilla Erlang.

I agree that the comparison with Haskell is ill fitting. The sentiment I wanted to express is that Elixir, like Haskell, is built around function (or module) composition, is immutable, and state is idiomatically handled separately (with separate processes and message passing, instead of monads).

Fallacy of composition. You're saying that any language with HOFs, immutability and "idiomatic way to contain state" is ergo Haskell-like, which is insane. None of these are even properties of Elixir, but of Erlang, which Elixir inherits. Erlang is self-evidently not Haskell-like. At best such a language would be merely functional. The actor model isn't even about anything analogous to monads, it's a concurrency model that happens to simplify concurrency control through isolation.

Re: Flirting with Elixir

#15
post #10
post #2

I've been "obsessed" with Elixir lately, and it truly is a breath of fresh air in the current programming language landscape. I've started with C, built a career with backend Python services/dashboards, and spent some time on the "fringe" learning about Lisp, Scheme, Haskell, Clojure. And once you rewire your brain with functional programming constructs or immutability, it is really hard to go back to Python, using l…

I agree. Whenever I open up an Elixir project, there's a certain joy. I'm not sure what it is exactly. The language is simply a pleasure to work in. > I've had a fling with Go I've used Go for quite a few things, but it never felt quite right. I've come to like some of the tooling around the language while hating the language itself. What really turned me away from Go was its community. There are a lot of people who…

FWIW, that's sort of the reason the community code of conduct was introduced (which many of the folks you complain about pushed against). I don't know how effective it is as I tend to avoid "community" groups for programming languages, but the major parties all claim to have adopted it.

http://coc.golangbridge.org/

Re: Flirting with Elixir

#16
Are macros useful in a web development context? I don't feel like I've been missing them in Django, but maybe I've just forgotten because it's been a long time since I wrote anything substantial in Scheme. (Are Elixir macros similar to Scheme macros?)

Re: Flirting with Elixir

#17
post #2

I've been "obsessed" with Elixir lately, and it truly is a breath of fresh air in the current programming language landscape. I've started with C, built a career with backend Python services/dashboards, and spent some time on the "fringe" learning about Lisp, Scheme, Haskell, Clojure. And once you rewire your brain with functional programming constructs or immutability, it is really hard to go back to Python, using l…

> if you ever used Django, raise your hands if you've ever had to delve into the source code to understand what is going on

This is a sentiment I don't understand at all. Why wouldn't you delve into the source code of tools you use? I do this with almost all the tools I use, be it languages or libraries (obviously I don't use non-opensource ones if I can avoid it). Looking inside libraries teaches you quite a lot and isn't even that difficult, especially if your editor+language combination support "Jump to Definition".

I think we'd be much better off, as an industry, if people learned to appreciate code reading. This would make writing readable code more desirable in the first place, which would be really great.

And BTW, Django has a really good looking codebase. You shouldn't start your reading with SQL compiler in the ORM, but, for example, class-based and generic views are a nice starting point. Another related codebase I can recommend is Django Rest Framework - really a must read for pythonistas who use Django.

> using large libraries feels too much like magic

That's actually my biggest gripe with Elixir. The fact that it happens on compile time (using) and not at runtime doesn't make its magic less magical. And it's very often not documented appropriately. The docs or examples tell you to `use` a module and that's it - you don't know what symbols are imported, let alone what the module macros will do with your code. And it's hard to tell by just looking at the module in question, because - macros. I can deal with it, but in general Elixir should either document its macros better or make things much more explicit.

> I've had a fling with Go, I really like some of its ideas, namely static linking, native compilation, no exceptions, easy deploy

Take a look at OCaml. All the features you mention and a non-brain dead type system on top of that. Multicore is a problem, but I hear it's improving fast.

> It's a mix between Haskell without purity and types and Clojure without parens, with a Ruby-style syntax and a battle-tested framework for concurrency and distributed computing.

That's probably the least flattering description of Elixir I've ever read. Haskell without purity and types would be utterly broken and useless. Similarly for Clojure and sexps. Elixir is neither - it is a nice langauge in its own right.

> I know I talk like a fanboy [...]

Well, I like Elixir too, there's nothing wrong with it. Really, Elixir has many nice features and a great potential; it's still growing, I think, and needs a bit more time to really mature, but is a viable choice for some projects already.

Re: Flirting with Elixir

#18

Earlier quoted context omitted.

Haskell without purity and types I'm getting quite tired of this "Every functional language I can't precisely describe is like Haskell" sentiment. It's the "tastes like chicken" of programming languages. Then again, the original article is remarkably devoid of content, so I suppose it's only fitting. Interestingly, avoidance of excessive magic is a large reason why I stick to vanilla Erlang.

I agree that the comparison with Haskell is ill fitting. The sentiment I wanted to express is that Elixir, like Haskell, is built around function (or module) composition, is immutable, and state is idiomatically handled separately (with separate processes and message passing, instead of monads).

[deleted]

Re: Flirting with Elixir

#19

Are macros useful in a web development context? I don't feel like I've been missing them in Django, but maybe I've just forgotten because it's been a long time since I wrote anything substantial in Scheme. (Are Elixir macros similar to Scheme macros?)

Macros are the most powerful tool for making DSLs, which means they pop up in a lot of "specialized" niches, like web dev. You can make DSLs in other ways, but without the ability to inspect and decompose code at the per-token level, there are limitations to what can be done.

Elixir macros are like Scheme macros; they're fully hygienic (no variable namespace issues), and they evaluate at compile time. The main difference is that Scheme's main syntax construction is the linked list, and Elixir uses a richer data structure, almost equivalent to JSON. Aside from the particular structure the macro's manipulating, the concepts are the same.

Elixir macros are also used idiomatically to allow "smart" loading of modules, e.g. specifying additional code to run in the caller's context rather than the callee's. They fit nicely for this purpose.

Re: Flirting with Elixir

#20

Earlier quoted context omitted.

I agree that the comparison with Haskell is ill fitting. The sentiment I wanted to express is that Elixir, like Haskell, is built around function (or module) composition, is immutable, and state is idiomatically handled separately (with separate processes and message passing, instead of monads).

Fallacy of composition. You're saying that any language with HOFs, immutability and "idiomatic way to contain state" is ergo Haskell-like, which is insane. None of these are even properties of Elixir, but of Erlang, which Elixir inherits. Erlang is self-evidently not Haskell-like. At best such a language would be merely functional. The actor model isn't even about anything analogous to monads, it's a concurrency mode…

> insane

Rather than sling around heavy duty words like "insanity", you might try putting yourself in their shoes: perhaps their only exposure to a functional language is Haskell. Elixir is going to look a lot more like that, than, say, C++.

Post reply on HN