Not only does it have a clean, pleasant syntax, macros, but it has all the good parts from Erlang, namely:
* BEAM VM (isolated heaps, very well tuned scheduler, concurrent garbage collection)
* Pattern matching, once you've tried it, it is hard to go back.
* Ability to call Erlang code
BEAM VM is really a secret gem and many didn't get a chance to play with it because they didn't like Erlang's syntax (personally, I do like Erlang's syntax, but I think many don't). Well there is little excuse now.
If you like DSLs and macros (yes, yes, I know it makes many people scared) this you can do neat stuff like these projects:
This is what I came here to say. All of the 'raw language' niceties that Geoffrey mentioned in the article are true, but for me one of the greatest things in Elixir is processes. Just, the way the Erlang system operates is so well thought out, I'm more impressed every time I learn something new.
Shameless self-promotion here - I run http://www.elixirsips.com, which is a screencast series that releases 2 new episodes per week covering some topic in Elixir. I started it out as I started learning Elixir, and I've been going for quite a while now (I'm on Episode 33 next, so 16 weeks so far). It's the most fun I've had with a programming language since I first saw Ruby, and I think the BEAM VM is the future (as is Rust/Go/clojure's core.async, other concurrency-oriented programming models, etc).
So yeah, Elixir's amazing and everyone should play with it. I think just looking at these items mentioned in the article aren't even giving it a fair shake - learn about Erlang's concurrency and distribution models, or else you aren't even scratching the surface :)
I'm a subscriber to Elixir Sips, and just wanted to say that the videos are well worth it to anyone looking to get into Elixir. I'm a happy subscriber, and look forward to more videos.
Thanks for posting this. I am going to subscribe to this. I've been hearing nothing but wonderful things about Elixir but have been struggling with making some mental connections. Your videos look like they'll help me make those connections.
InputStream in = new FileInputStream( "./test/lox/test/zooinventory.xml" );
Document doc = LOXHandler.load( in );
List<Element> animals = doc.find( "Inventory/Animal" );
System.out.println( "animals found: " + animals.size() );
for( Element animal : animals )
{
String habitat = animal.findFirstString( "Habitat" );
String lifestyle = animal.findFirstString( "Lifestyle" );
...
}
...
// Actual example of some globbing
List<Element> names = doc.find( "Inventory/*/Name" );
System.out.println( "names found: " + names.size() );
What I really want in a future language is for those glob paths to be first order objects, not magical strings. Then the compiler can do some sanity checking, editor can do autocompletion, etc.
Ever since I started getting into Clojure, I've been getting interested in these other functional programming languages. Lately I've been checking out Elixir. I don't know what draws me to it (most likely the pretty website and logo :P, and partly because I hate the Java ecosystem). I want to get into it as well, but I just don't see myself using it for anything? I mean for the types of problems I'm capable of solving, Clojure (and Python) seems to be sufficient. To me, it seems Erlang (and thus Elixir) only offers its advantages when building really large distributed systems. Is there any other use case for Erlang/Elixir?
I'm still going to be reading up on Erlang/Elixir for fun and to expand on how I approach problems, but right now I only associate Erlang with large distributed systems and I want to add other stuff to that association.
Yes, the use case is usually for highly concurrent system. There just happen to be quite a few of those in recent years. Multiple things happening at the same time colloquially speaking. Now it won't be good for fast concurrent problems, like say multiplying matrices, or computing FFT, you'd use a GPU and Fortran for that perhaps. But think of large game server with multiple worlds, and players trading with each other. Think of a large distributed database (like Riak). Think of the backend of large VOIP systems with multiple calls happening at the same time. Or maybe a large chat system (Ejabberd).
Erlang as a general purpose programming language is also interesting. It forces you to think about problems in a different way. Actually 2 ways: -- functional and using actors.
Also, its primary characteristic and design goal is fault tolerance. That was #1 item on the TODO list when it was designed. It is one of the very few languages and systems that has that as the primary goal. Many of the other features -- concurrency, isolation, run-time code upgrade, immutability of data structures, kind of fall out of that. So that is another general area that you might consider where using it makes sense.
On types -- many criticize Erlang for not having a static type system. Not all is lost. Erlang has a way to analyze its types using dialyzer. It is a success typing system. http://erlang.org/doc/reference_manual/typespec.html . The more you annotate the code the better it gets. Dialyzer will not catch all the errors BUT when it complains, it is guaranteed to be an error.
To go hand in hand with that. It has very neat (3rd) party testing tools available. One of the most interesting ones are for Property Tests. These allow you to specify model constraint on your code and it will automatically generate tests to try to find failing use cases that break the constraint.
Anyway, hopefully this gives a bit more of an idea.
To go hand in hand with that, on the testing side it has
It's interesting to see Elixir mentioned more and more. I don't _quite_ see the use-case for it, but I'm so content with Erlang I'm almost surely not the audience the language targets. Will be fun to see if Elixir builds its own community or if Elixir folks slowly filter into the Erlang community as a whole.
- - -
EDIT
It occurs to me that the HN crowd might like Lisp Flavored Erlang: http://lfe.github.io/ It's a lisp-2 written by Robert Virding, co-creator of Erlang, and is backed by a great group of folks.
Erlang is designed to create solid production systems. If someone is obsessed with quick hacks and fad-of-the-week programming, they will feel uncomfortable in a real development environment.
Yeah, so Erlang's syntax is prolog inspired and can seem a little peculiar if you're using Algol inspired languages a lot. I _vaguely_ recall a feeling unfamiliar in Erlang land because of syntax but now, six years in, I hardly care about the syntax of _any_ language. It's just the thing you get used to, like speaking in foreign languages. It's just the water in which you swim.
i don't know from your high horse, but from down here, erlang satisfies my needs for badly written hacks just fine.
more so that all implementations have a in memory DB so i don't even have to bother with that as i would have with php... so yeah, installing yaws and writting <h1>hello world</h1><erl>...</erl> is as PHPish as it gets for quick web prototypes.
the above said, the easy of use of yaws is what makes me reticent to even start to play with elixir. i'd be very pissed it i like it but had to go back to plain erl for web prototypes.
I am not sure if it targets me either but one thing I like is the pretty website and docs... AND that is important to me when I am playing with something new.
I recently started programming in Elixir. I chose to rewrite the customized Hubot instance I'm running at my company from the ground up in it - it's been a great way to learn the language, and especially OTP.
OTP is really what makes Elixir (and Erlang for that matter) so impressive. Supervised, lightweight processes just seems so obvious as a solution to fault tolerance and concurrency - coming from C#, where doing multi-threaded programming is error-prone at best, Elixir/OTP is a dream. I do miss the type system from C# or Scala, but type specifications help to mitigate the loss.
The one other feature that has been really pleasing to work with is pattern matching. Scala is the only other language I've used with some form of it, and after using Elixir/Erlang's pattern matching, Scala's seems deficient in comparison. It's an insanely powerful construct, I wish more languages had it.
A couple months ago I got into Project Euler and decided to tackle all of the problems with Elixir. It was a great way to learn syntax and performance nuances. Definitely a tool that I enjoy using and will be keeping up with.
> For years I’ve wanted to be able to write my own control flow structures, such as an each...else that runs an else block if the each is empty (Handlebars templates have this).
Actually, python does have a (little-known) `for...else` structure that does what you want.
python's for/else doesn't do what the grandparent post asked for -- that post asked for the else clause to execute if the container that was being iterated over is empty, and in python's for/else (as your link notes) the else clause executes whenever the for clause terminates normally (that is, other than by a break statement). These are very different constructs.
I think it's interesting the extent to which lisp is slowly but steadily insinuating itself into people's brains and into new languages.
There are the modern, obvious lisps like Racket and Clojure.
Then there are things like Honu, Pyret, Elixir, and more, which sidestep many people's "parenoia" [sic]. They do the homoiconic, macro thing without any supposedly frightening s-expressions.
Because, as I read this post, I'm thinking, well hell, all of these features [1] are syntactic sugar that already exist in e.g. Racket, and if they didn't, could be added by anyone. Especially anything like "I always wanted this control structure in Python/Ruby/whatever", well, you can just do it. This is really liberating.
Sure you can argue that people will do dumb things with this capability, or that you "don't really need X", and so on. But being able to do it when you need/want is really awesome.
[1] I'm referring to the points in the post, not everything that Elixir and/or Erlang can do.
I'm very interested in Elixir but I'm having trouble understanding the benefit of the 'upcase' example at the end of the article. Compared to a single function with a conversion table, a function per character seems like a tremendous amount of overhead.
Is the purpose of implementing upcase this way to make it more easily parallelizeable in the map/reduce sense?
Groovy seems like such a... Forgotten language, sometimes. For what it's worth, I've always really liked it. And I hate Java with the fire of one thousand suns.
7 months ago, Groovy wasn't even in Tiobe's top 50. Two months ago (Oct 2013), it had reached #18. This month, it's back down to #46. The person who pulled off that trick didn't forget Groovy, and in fact utilized the feedback effect to keep the afterglow going. Just type "Groovy Programming" into Google and see some of the links...
5. www.infoworld.com Groovy breaks into top 20 list of programming languages
8. www.eweek.com Groovy Programming Language Sees Major Boost in Popularity
22. cacm.acm.org Groovy Programming Language Sees Major Boost in Popularity
24. jaxenter.com Groovy makes debut entry into programming language top twenty
30. glaforge.appspot.com Interview about Groovy's popularity boost -- Guillaume Laforge's Blog
But Groovy's "surge in popularity" was probably timed to coincide with a due diligence investigation on Pivotal Inc, or someone there selling a consulting contract.
"After a long discussion with one of the Tiobe index readers, it turned out that the data that is produced by one of the Chinese sites that we track is interpreted incorrectly by our algorithms. So this was a bug," Janssen said. "After we had fixed this bug, Groovy lost much of its ratings." http://www.infoworld.com/t/application-development/c-pulls-a...
I tried to like Erlang, but the syntax turned me off.
Elixir was just what I needed. Makes the power of Erlang accessible. I like Elixir's docs, tooling, and syntax, and look forward to seeing it progress.
Not only does it have a clean, pleasant syntax, macros, but it has all the good parts from Erlang, namely:
* BEAM VM (isolated heaps, very well tuned scheduler, concurrent garbage collection)
* Pattern matching, once you've tried it, it is hard to go back.
* Ability to call Erlang code
BEAM VM is really a secret gem and many didn't get a chance to play with it because they didn't like Erlang's syntax (personally, I do like Erlang's syntax, but I think many don't). Well there is little excuse now.
If you like DSLs and macros (yes, yes, I know it makes many people scared) this you can do neat stuff like these projects:
https://github.com/elixir-lang/ecto -- DSL to query databases