Brujo has been a programmer since the age of 10 and he has more than 15 years in the industry. He was a VB, .NET, Java and Haskell programmer until he found Erlang 8 years ago. He’s now Inaka's CTO and Erlang Solutions’ Tech Lead and Trainer. He’s an active member of the open-source community and his blog (Erlang Battleground on Medium) was the most active Erlang blog of 2016.
10 January 2017
Erlang Easter Eggs
I’m back! Cask removed, arm in recovery :) — Let’s celebrate with some funny bits of Erlang/OTP!
Up to this point, I’ve been sharing a good number of odd and/or confusing bits for and about erlangers out there. I’ll go back to that, probably next week. But, during the same period in which I collected all those battle-stories, I also found several nice bits of code and documentation that are shipped with the Erlang/OTP distribution. They go a long way to show how the language was created and how it evolved. It was programmed with fun! That’s certainly my favourite way to code.
Aliens Among Us
To begin with, let me show you a really nice utility you can find in Erlang/OTP: The erlang tracer. Yeah, erlang_tracer was a really long name back then (see below), so its authors called it et. And, of course, with a module like that who can miss the chance to create this function?
1> et:phone_home(1, from, to, msg, opts). hopefully_traced 2>
I actually wrote a module using it a while back, and tweeted about it…
Hardcore Name Jokes
%% The name zf is a joke!
I had the chance to meet him last year and ask him what was the joke about and he told me it’s a joke about Zermelo and Fraenkel. Let’s see what these gentlemen have to say about that joke…
No Objective-C Devs Allowed Here
If you remember from one of my previous articles, you have many types for lists in Erlang. And in that article I only listed the proper ones (i.e. the ones that represent valid lists). Erlang allows you to use improper lists as well, but the developers found an excellent way to prevent devs from doing that. According to the note in that page:
The following built-in list types also exist, but they are expected to be rarely used. Hence, they have long names:
nonempty_maybe_improper_list() :: nonempty_maybe_improper_list(any(), any()) nonempty_improper_list(Type1, Type2) nonempty_maybe_improper_list(Type1, Type2)
True story, man! Who has time to use such long type names, right?
This one is a classic. In Erlang, both keywords and atoms are written as lowercase words (well… atoms can also be written within single quotes, but let’s forget about that for a bit). Most of the times, that’s not an issue: you know that if is a keyword, case is a keyword, my_function is not, etc.
But there are a few reserved words that are not actually keywords (in the sense that you can’t build expressions with them) but they’re also not atoms. They’re just reserved for the future. A while back (before OTP17) the one that everybody stepped over was query. Since then, you can finally write a function called query, but 2 other magic keywords still remain. Let’s see if you can spot them by comparing the list of reserved words here with the list of valid expressions here ;)
That’s All Folks!
Hope you have enjoyed it. See you next week with more battle stories!
25 Jul 2016
A video exploring the potential of fast simulated...
08 Aug 2016
Gradle did come to stay with us. Although...
22 Aug 2016
Software Testing is not for Attention...
19 Sep 2016
New video from #droidconpl2015 is out!...
19 Sep 2016
Last night I attended a software testing...
21 Oct 2016
A summary of my visit from SystemD Conference...
24 Oct 2016
Up until yesterday, I had only gone...
24 Oct 2016
Updating sources (versions, revisions, tags)...
14 Nov 2016
Elixir is a joy to work with, an easy...
16 Nov 2016
A few weeks ago I attended Mobiconf, one of...
10 Jan 2017
Rok Garbas discusses the technology...
16 Jan 2017
Build a complete iOS messaging app using...