Elixir - Old wine in new casks
This is a modal window.
The media could not be loaded, either because the server or network failed or because the format is not supported.
Formal Metadata
Title |
| |
Subtitle |
| |
Title of Series | ||
Number of Parts | 542 | |
Author | ||
License | CC Attribution 2.0 Belgium: You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor. | |
Identifiers | 10.5446/61682 (DOI) | |
Publisher | ||
Release Date | ||
Language |
Content Metadata
Subject Area | ||
Genre | ||
Abstract |
|
FOSDEM 2023233 / 542
2
5
10
14
15
16
22
24
27
29
31
36
43
48
56
63
74
78
83
87
89
95
96
99
104
106
107
117
119
121
122
125
126
128
130
132
134
135
136
141
143
146
148
152
155
157
159
161
165
166
168
170
173
176
180
181
185
191
194
196
197
198
199
206
207
209
210
211
212
216
219
220
227
228
229
231
232
233
236
250
252
256
258
260
263
264
267
271
273
275
276
278
282
286
292
293
298
299
300
302
312
316
321
322
324
339
341
342
343
344
351
352
354
355
356
357
359
369
370
372
373
376
378
379
380
382
383
387
390
394
395
401
405
406
410
411
413
415
416
421
426
430
437
438
440
441
443
444
445
446
448
449
450
451
458
464
468
472
475
476
479
481
493
494
498
499
502
509
513
516
517
520
522
524
525
531
534
535
537
538
541
00:00
Distribution (mathematics)Concurrency (computer science)Data modelSystem programmingTelecommunicationErlang distributionCodeComputer programmingGoogolFacebookJava appletMobile WebComputer fontFrame problemProduct (business)Source codeFunctional (mathematics)TorusPhysical systemSystem callMathematicsSource codeRun time (program lifecycle phase)CodeErlang distributionCombinational logicBitThread (computing)Connected spaceComputer programmingMultiplication signTheoryCategory of beingNetwork topologyProcess (computing)Formal languageTelecommunicationVirtualizationFacebookCASE <Informatik>Software developerMereologyDiagramComputer animation
05:40
Operator (mathematics)Digital filterSummierbarkeitTelephone number mappingLevel (video gaming)Streaming mediaMacro (computer science)Communications protocolString (computer science)Block (periodic table)Kernel (computing)BuildingParameter (computer programming)Software testingBoolean algebraEnumerated typeFunction (mathematics)Principal ideal domainInteractive televisionTerm (mathematics)AlgorithmModule (mathematics)TensorExponential functionSmoothingArmErlang distributionLibrary (computing)NumberModule (mathematics)String (computer science)Extension (kinesiology)Projective planeMacro (computer science)Virtual machineHacker (term)Functional (mathematics)System callParameter (computer programming)Text editorSoftware frameworkCommunications protocolMultiplication signBitFormal languageExpressionVapor barrierResultantSoftware testingElectronic mailing listWeb 2.0Sound effectNeuroinformatikBookmark (World Wide Web)Computer animation
11:15
Game controllerModule (mathematics)Radio-frequency identificationProgram flowchart
Transcript: English(auto-generated)
00:06
Alright, cool. So again, apologies for being this late. I really don't take it out on the people that are organizing this room. It's really my fault. So I hope still you have a nice day and I'll try to keep it short so we stay on schedule. So this is kind
00:21
of an introductory talk for people that are new to Elixir and Erlang. So Elixir is a language which now already exists for 10 years and it's built on top of the Beam virtual machine, also called the Erlang VM. So it inherits some of the properties that the Beam runtime has as well. And Beam runtime is actually created for telecom systems. So it's meant to be 24-7 on and by doing that it has to be full
00:47
tolerant, so if something goes wrong it can still heal and keep on running. And because it has to be on all the time, that also means that any code changes should be done on the fly while the system is running without interruptions, without bringing systems down, bringing systems up, but
01:03
just keep things running on and changing the code under the hood. It also needed to be concurrent because it needed to handle a lot of incoming telephone calls at the same time and it also needs to be distributed because you have to connect telephone switches together and make
01:20
sure that everything runs smoothly. So those are kind of the properties that that Erlang also inherited from Erlang as well. So when you look at other systems, multi-threaded... Okay, programming can be hard, so in theory it should all work like we have
01:42
you know if you want to do something concurrently we spawn a few threads and they do their work, but in practice because threads can actually interfere with each other's work, it actually becomes a mess. So hence the second picture. The other property that Erlang has is full tolerance.
02:02
So in Erlang you set up a supervision tree in which a supervisor is actually watching, monitoring or worker and if one of those processes dies then the supervisor actually makes sure that a new process is spawned in its place and the system as a whole keeps running even though one of the parts actually fail. Hence also the mantra that's very often told in Erlang is let it crash.
02:27
Nice timing, okay. Because people feel safe by, you know, if there's an exception, if your code always goes for the happy path and something goes wrong, Erlang developers tend to not care that
02:42
much about it because the supervisor will restart that process again. So very exceptional. Edge cases are sometimes not covered because they feel comfortable having the system pick it up from there as well. Before Elixir came around, Erlang also existed for quite some while.
03:03
So Elixir also inherited some of the kind of the experience of 20 years building telecom systems which also makes it, for example, WhatsApp had only 57 engineers working for them when they sold to Facebook. But only about 20 of them were Erlang developers.
03:20
The rest were actually mobile developers supporting Androids, Windows, iOS, etc. And actually could handle a lot of users while having a small team. So then the question also comes a little bit why does Elixir exist? And when people innovate and build new things, there are approximately three things,
03:44
three ways they can go around it. So they completely build something very new, which didn't exist before, or they try to combine ideas from previous, from other fields, for example. Or in some cases, people just, you know, put a new label on it and say,
04:02
well, this is new, you know, this is innovation. So my, hence the title of my talk, is Elixir really something new? Or is it just a new label on the existing Erlang foundation? And some other languages, they, you know, they've tried to incrementally do some innovations.
04:24
But after a while, the original sources picked up those changes in this, like CoffeeScript is a very famous example, in which the original language picked up those changes, and nowadays a lot less people actually use CoffeeScript.
04:42
So, how are we doing on time? Okay. So the question is then also why did, Jose is kind of the creator of Elixir, why did he write a new language? And he was at a time when he wrote Elixir, he was working at Rails team, and one of the things that he faced was trying to make Rails thread safe.
05:01
So making sure that several threads that were running in the Rails program weren't interfering with each other. And by doing that, he was actually looking around, how did other folks, how did other programming languages, other frameworks, how did they solve that issue? And that's when he actually stumbled upon Erlang, and he liked it. It was, you know, just the thing he needed to use.
05:25
But there were also some things that he was actually missing. So, for starters, the syntax stems from Prolog, so it's unfamiliar for a lot of people. So that means that new people who come to Erlang have to, you know,
05:42
have a high barrier to actually get around, because they feel unfamiliar with the syntax. So he did that first, and he also introduced other new syntax, for example, the pipe operator, in which, like the result of the previous expression is piped into the next function as the first parameter.
06:05
So by doing that, you can avoid having a very nested function calls by having something that's more readable, more clear to other people. He also introduced more extensibility to the language by introducing macros and protocols.
06:22
And one of my favorites is actually the bottom one. I'm not sure if everybody can read it, but it's an upcase function, which takes a string and upcases every letter. And it does that under the hood via a macro, so the Unicode definition, like the library definitions of characters is downloaded,
06:42
and actually being translated to functions under the hood. So when you call this, you're actually using, you know, some data that is transformed into functions for the language. I'll skip over this part, because we don't have Dutchman time. And you also actually see that those macros are used everywhere.
07:02
So even like, you know, defining module is a macro, defining a function, etc., everything is actually implemented through macros. The other thing that he also introduced is the build tool, to make it easier for people who are, for example, new to the language.
07:20
If you want to have a package manager, before didn't really have package management, like in the sense that you could add packages to your project, but you had to download them by yourself, put them somewhere, define it in your config, like, okay, this is the path to my library that I'm using. And with hacks and with mix, Alex just made it easier,
07:44
by, you know, by having a list of dependencies and go download it from a central place. The computation was also made more prominent. For example, the doc tests, which are inspired by Python. So in this case, we have a function defined,
08:00
and above it is a document, a comment, in which there is an example. And this example doesn't serve only for documentation, but in the same time, it's also a test. So, you know, actually, if you would change the implementation, you can directly see the effect of it, because the test is just above it, as documentation fails.
08:25
So, and, yeah, the documentation is also accessible from REPL, from other places, and this was built before the LSP. So nowadays, you can, you know, just hover over a function in your editor and you will see the documentation. But when Elixir was created, those functionalities weren't that common,
08:44
like among other languages, and that's something that's really nice to work with. And the last thing that he kind of also introduced is a different culture, a culture which is a little bit more open to newcomers. So it's not like Erlang, you know, shed away from newcomers,
09:02
but it also didn't, like, make it easier for new people to, who are new to the language, to get started with it, et cetera. So that whole, you know, like, to come back to my question, like, is Elixir a kind of new flavor on top of Erlang?
09:23
I think there are kind of projects stemming from Elixir which make it more interesting and which are really new. So, for example, NX Numerical Elixir is an extension which makes machine learning easy, and that's something that, you know, before Elixir,
09:41
nobody actually thought would be useful to do with the Beam, with the Erlang VM, because it wasn't not meant for that. It wasn't meant for numerical, for number crunching. But this library, this tooling actually makes it a lot easier to do, and that's very promising. Phoenix is actually a web framework which was inspired by Rails,
10:02
and now, so you worry around, Phoenix is now an inspiration for Rails and other frameworks to work with. And NURBS is also kind of an interesting project which makes it possible to run on smaller devices like Raspberry Pis or something like this. So, to answer the question, is Elixir really different from Erlang?
10:23
Is it really, you know, an innovation or is it rehashing? I would say no. I think Elixir really adds something to the whole ecosystem which wasn't that easy before that. So, with that being said, thanks for listening.
10:49
Thank you. Unfortunately, we don't have any time for Q&A, but you can find it here. So, if you're looking for me online, I usually have the handle Toxified, so on Twitter, if it still works,
11:01
or Mastodon, you can also find me. And I'll be around, I think, for today if you have any further questions. So, thanks again for listening, and apologies for being this late. Thank you again.