Latest / CyberSecurity Summary / Introducing Erlang: Getting Started in Functional Programming
Transcript
- 0:00Speaker 1: Imagine trying to write a computer program where it's mathematically
- 0:05Speaker 1: impossible to count it two.
- 0:07Speaker 2: Right, where you literally cannot tell the computer, you know,
- 0:09Speaker 2: take the number one, add one to it and save
- 0:12Speaker 2: the result.
- 0:12Speaker 1: Yeah, exactly. Welcome to the deep Dive today. We're taking
- 0:16Speaker 1: you on a journey into a programming language that well,
- 0:20Speaker 1: it basically asks you to completely empty your conceptual toolbox.
- 0:24Speaker 2: Just forget what a hammer even looks like.
- 0:26Speaker 1: Pretty much. We are exploring Erlang today and we're using
- 0:30Speaker 1: Simon San Laurent's book Introducing Erlang, the second Edition as
- 0:35Speaker 1: our map.
- 0:35Speaker 2: It's a great guide for this, it really is.
- 0:38Speaker 1: And our mission for this deep dive is to crack
- 0:40Speaker 1: open the whole functional programming paradigm. We're going to look
- 0:43Speaker 1: at how a language that was, you know, originally designed
- 0:46Speaker 1: by Ericson back in the eighties for telephone switching.
- 0:49Speaker 2: Equipment, which sounds so niche, right, but.
- 0:51Speaker 1: How it secretly became the absolute backbone of the massively
- 0:55Speaker 1: parallel systems you rely on literally every day.
- 0:58Speaker 2: I mean, it is the ghost in the machine for
- 1:00Speaker 2: some of the biggest tech infrastructure on earth, like when
- 1:03Speaker 2: you send a WhatsApp message or when modern Noseql databases
- 1:07Speaker 2: like couch dB are shuffling billions of records across servers globally.
- 1:11Speaker 2: They are relying on Erlang.
- 1:13Speaker 1: It's wild to think about.
- 1:15Speaker 2: It is because it was built for a highly specific
- 1:18Speaker 2: world telecom networks that simply cannot afford to fail, systems
- 1:23Speaker 2: that must handle millions of simultaneous actions without breaking a sweat, and.
- 1:27Speaker 1: Where you need to update the code while the system
- 1:29Speaker 1: is still running.
- 1:30Speaker 2: Exactly, you can't just take down the phone network to
- 1:32Speaker 2: run an update.
- 1:33Speaker 1: Which sounds incredibly complex. Oh, but there's a quote from
- 1:36Speaker 1: the author that I think cs as a perfect warning
- 1:39Speaker 1: label for what we're about to do. He says, erlang
- 1:42Speaker 1: is a language that makes hard things easy and easy
- 1:45Speaker 1: things hard.
- 1:46Speaker 2: That is so true. To learn erlang, you essentially have
- 1:49Speaker 2: to unlearn everything you know about traditional programming.
- 1:52Speaker 1: Oh completely.
- 1:53Speaker 2: You have to clear your mind of classes, objects, and
- 1:56Speaker 2: most jarringly, honestly, variables that change their values over time.
- 2:00Speaker 1: Yeah, that's the big one.
- 2:02Speaker 2: You just stop trying to micromanage the state of the
- 2:04Speaker 2: computer's memory. Instead, you design pathways for data.
- 2:08Speaker 1: To flow through, like a routing network.
- 2:10Speaker 2: Exactly, you are building a routing network, not a step
- 2:13Speaker 2: by step instruction manual.
- 2:14Speaker 1: Okay, let's unpack this, because to understand just how alien
- 2:18Speaker 1: Arland can feel to a traditional developer, we really have
- 2:22Speaker 1: to start at the absolute foundational level.
- 2:25Speaker 2: The very bottom right.
- 2:26Speaker 1: We have to look at how it handles basic numbers
- 2:28Speaker 1: and variables. And I mean even here, Erlang plays entirely
- 2:32Speaker 1: by its own rules. It splits numbers into integers and
- 2:36Speaker 1: floating point numbers or floats.
- 2:37Speaker 2: And the introgers in arline are basically a mathematicians dream.
- 2:41Speaker 2: Oh yeah, yeah, they can be incredibly massive tracking astronomical sums,
- 2:45Speaker 2: but they always remain perfectly precise. They just consume more
- 2:49Speaker 2: memory as they grow.
- 2:50Speaker 1: But floats are different.
- 2:51Speaker 2: Right. Floats, however, are bound by the sixty four bit
- 2:54Speaker 2: i e E. Seventy five four nineteen eighty five representation.
- 2:58Speaker 1: Okay, that specific means the computer is essentially doing scientific
- 3:02Speaker 1: notation under.
- 3:03Speaker 2: The hood exactly.
- 3:04Speaker 1: So it allocates one bit for the positive or negative sign,
- 3:07Speaker 1: eleven bits for the exponent, and fifty two bits for
- 3:09Speaker 1: the actual.
- 3:10Speaker 2: Fraction, which sounds like a lot It does.
- 3:12Speaker 1: So it's keeping track of about fifteen decimal digits of precision.
- 3:16Speaker 1: It can represent a gigantic range of values from the
- 3:19Speaker 1: microscopic to the cosmic, But it inherently loses precision at
- 3:24Speaker 1: the extreme ends because it physically runs out of bits
- 3:27Speaker 1: to store the exact number.
- 3:28Speaker 2: Which leads to fascinating quirks and pure mathematics.
- 3:31Speaker 1: Right.
- 3:32Speaker 2: The source material points out that if you ask Erling
- 3:34Speaker 2: to calculate the sign of pie, a strict mathematical function
- 3:38Speaker 2: that should yield absolute zero, Erling won't give you zero.
- 3:41Speaker 1: Wait, really, what does it give you?
- 3:43Speaker 2: It gives you something like one point two to two
- 3:45Speaker 2: times ten to the negative sixteenth power.
- 3:48Speaker 1: Wow. I mean, it's microscopically close to zero, but it's
- 3:52Speaker 1: a rounding error. It's born from trying to map base
- 3:55Speaker 1: ten decimal math onto base two binary storage.
- 3:58Speaker 2: Right, And if you're building a SIS that requires a
- 4:00Speaker 2: strict check like does x equal exactly zero, that float
- 4:05Speaker 2: approximation will cause your system to fail.
- 4:07Speaker 1: She have to anticipate those physical hardware limits exactly. But
- 4:10Speaker 1: speaking of basis, the author included this detail about base
- 4:12Speaker 1: systems that I think fundamentally explains Erline's telecom DNA.
- 4:16Speaker 2: Oh the base thirty six step.
- 4:17Speaker 1: Yeah, Erlin lets you calculate in any base up to
- 4:20Speaker 1: base thirty six.
- 4:21Speaker 2: Yeah, you use a specific notation for this. You type
- 4:24Speaker 2: the base number a hash symbol, and then the value
- 4:27Speaker 2: base thirty six uses all ten numerical digits zero through
- 4:31Speaker 2: nine and all twenty six letters of the English alphabet, which.
- 4:35Speaker 1: I mean sounds like a neat party trick until you
- 4:37Speaker 1: think about what Ericsson was trying.
- 4:39Speaker 2: To do in the AES right routing those calls.
- 4:41Speaker 1: Exactly, if you are routing millions of simultaneous phone calls,
- 4:45Speaker 1: you have to assign a unique session ID to every
- 4:48Speaker 1: single call. If you use a standard base ten number,
- 4:52Speaker 1: that ID gets incredibly long, chewing up precious memory.
- 4:55Speaker 2: But if you compress that massive number into base thirty six,
- 4:59Speaker 2: it shrinks down to it tiny alphanumeric string.
- 5:01Speaker 1: It's the exact same reason your airline ticket uses a
- 5:04Speaker 1: six character alphanumeric booking code like G six ZV one N.
- 5:09Speaker 2: Yeah, it's a massive, complex identifier compressed into a tiny footprint.
- 5:13Speaker 2: Erline can just ingest that base thirty six string and
- 5:15Speaker 2: natively do math with it, which saves memory when millions
- 5:18Speaker 2: of processes are firing at once.
- 5:20Speaker 1: It is a profound optimization for routing massive amounts of data.
- 5:24Speaker 1: But honestly, the numbers aren't what causes new Urline programmers
- 5:28Speaker 1: to pull their hair out.
- 5:29Speaker 2: No, not at all.
- 5:30Speaker 1: The real shock is the concept of the unchanging variable.
- 5:33Speaker 2: Yes, so all variables in erline must start with a
- 5:37Speaker 2: capital letter. But the real mind bender is single assignment. Right,
- 5:41Speaker 2: You can only bind a value to a variable once
- 5:44Speaker 2: in a given context. If you write n equals one,
- 5:47Speaker 2: Erlang agrees n is one.
- 5:49Speaker 1: Okay, seems normal so far.
- 5:50Speaker 2: But if you try to increment it on the very
- 5:52Speaker 2: next line by writing n equals n plus one, the
- 5:54Speaker 2: system crashes.
- 5:55Speaker 1: It throws an exception error and refuses to execute completely. Wait,
- 5:59Speaker 1: if a variable can never change, how do you keep
- 6:01Speaker 1: score in a video game, or you know, how do
- 6:04Speaker 1: you track a bank account balance going up and down?
- 6:06Speaker 1: It feels like trying to write a novel where you're
- 6:08Speaker 1: only allowed to use a nou in one single time.
- 6:11Speaker 2: You'd just be inventing new words constantly. Exactly, Well, it
- 6:14Speaker 2: forces a completely different mental model. Erling does this because
- 6:18Speaker 2: n equals n plus one is an algebraic impossibility. N
- 6:22Speaker 2: cannot equal itself.
- 6:23Speaker 1: Plus one, right, impure math that makes no sense exactly.
- 6:26Speaker 2: Erline treats variables like strict mathematical truths. A variable is
- 6:31Speaker 2: simply a snapshot of truth at a specific moment in time,
- 6:34Speaker 2: and by enforcing this single assignment discipline, Erlin completely eliminates
- 6:39Speaker 2: a massive category of failures known as state change bugs
- 6:42Speaker 2: or race conditions.
- 6:43Speaker 1: Well, race condition okay, okay. So imagine two different parts
- 6:48Speaker 1: of a massive program trying to change the same variable
- 6:51Speaker 1: at the exact same microsecond. Let's say my bank balance
- 6:55Speaker 1: is one hundred dollars, I deposit ten dollars on my
- 6:58Speaker 1: phone app, and at that exact same millisecond, an automatic
- 7:02Speaker 1: subscription withdraws ten dollars.
- 7:04Speaker 2: A classic scenario.
- 7:05Speaker 1: Both processes read the balances one hundred, the phone app
- 7:08Speaker 1: adds ten and updates the balance to one hundred and ten.
- 7:11Speaker 1: But a millisecond later, the subscription subtracts ten from the
- 7:14Speaker 1: original one hundred and updates the balance to ninety. Yep,
- 7:17Speaker 1: the deposit is completely overwritten and lost forever because the
- 7:20Speaker 1: state changed out from out of the system.
- 7:22Speaker 2: That is exactly what a race condition is. When millions
- 7:26Speaker 2: of operations are happening simultaneously, like in a global messaging app,
- 7:30Speaker 2: If variables can constantly change their values and shared memory
- 7:34Speaker 2: keeping track of what is true at any given microsecond
- 7:37Speaker 2: becomes a total nightmare.
- 7:39Speaker 1: So how did traditional languages handle it?
- 7:41Speaker 2: It requires complex locking mechanisms that just slow the whole
- 7:44Speaker 2: system down. By making variables immutable, you never have to
- 7:47Speaker 2: lock them. Oh, I see, a process just takes that
- 7:50Speaker 2: snapshot of truth, performs a calculation, and passes an entirely
- 7:54Speaker 2: new result forward to the next process.
- 7:56Speaker 1: Okay, So if we can't change variable states in a
- 7:59Speaker 1: loop and we're passing snapshots of truth forward, we need
- 8:03Speaker 1: a highly organized way to receive those snapshots. We have
- 8:06Speaker 1: to rely on functions.
- 8:07Speaker 2: Yes, functions in Erlang live inside modules, which are simply
- 8:11Speaker 2: files ending in dot eerl and Erlang categorizes these functions
- 8:16Speaker 2: with incredible strictness, using a concept called anareaty right.
- 8:20Speaker 1: Arity, which refers to the number of arguments the function takes.
- 8:23Speaker 1: The author builds a physics function called fall velocity. But
- 8:27Speaker 1: if you have fall velocity a slash one meaning it
- 8:29Speaker 1: accepts one piece of data, and fall velocity slash two,
- 8:32Speaker 1: meaning it accepts two pieces of data, Erlang views those
- 8:36Speaker 1: as completely unrelated entities.
- 8:39Speaker 2: They just happen to share a similar name. That strict
- 8:42Speaker 2: categorization is vital because it ensures data and never gets
- 8:46Speaker 2: sent to a function that isn't perfectly equipped to handle
- 8:48Speaker 2: its exact shape and size. Makes sense, but writing these
- 8:51Speaker 2: precise functions is only half the battle. The true genius
- 8:54Speaker 2: of erlang is how those functions are executed by the
- 8:57Speaker 2: virtual machine.
- 8:58Speaker 1: Beam boggeds erlying abstract machine. When you write erline code,
- 9:03Speaker 1: it compiles down into a format that Beam processes. And
- 9:07Speaker 1: Beam really seems to be the actual secret sauce behind
- 9:10Speaker 1: Erline's legendary scalability. Oh.
- 9:13Speaker 2: Beam is a masterpiece of engineering. In most programming languages,
- 9:16Speaker 2: if you want to take advantage of a modern multi
- 9:18Speaker 2: core processor, the developer has to manually write complex code,
- 9:22Speaker 2: despawn threads, divide the work, manage the shared memory.
- 9:26Speaker 1: And then sure the processors don't step on each other's
- 9:28Speaker 1: toes right exactly.
- 9:30Speaker 2: But Beam takes all of that off the developer's plate.
- 9:33Speaker 2: It has a built in process scheduler. Wow, You, the programmer,
- 9:37Speaker 2: don't even need to know how many cores the host
- 9:40Speaker 2: computer has. You just write tiny independent processes and Beam
- 9:45Speaker 2: perfectly distributes them across the available hardware.
- 9:48Speaker 1: So Beam is essentially a super efficient, hypercaffeinated office manager.
- 9:52Speaker 2: That's a great way to look at it.
- 9:54Speaker 1: You just hand this manager a giant stack of isolated tasks.
- 9:57Speaker 1: They look at the office, see who is free, and
- 9:59Speaker 1: instant distribute the work. You never have to micromanage who's
- 10:02Speaker 1: doing what right And because a single assignment, these workers
- 10:06Speaker 1: don't share desks or files. They work in total isolation.
- 10:09Speaker 2: Which leads to Beam's other superpower, its unique garbage collection strategy.
- 10:14Speaker 1: All right.
- 10:15Speaker 2: In traditional languages, cleaning up old, unused data in shared
- 10:19Speaker 2: memory often requires pausing the entire system. It's called a
- 10:22Speaker 2: stop the world garbage collection.
- 10:24Speaker 1: Which sounds terrible for a telecom network.
- 10:26Speaker 2: It is because Erlang processes share no memory. Each tiny
- 10:30Speaker 2: process has its own private garbage collector.
- 10:33Speaker 1: Oh wow, So if one process crashes or runs out
- 10:36Speaker 1: of memory, it doesn't take down the whole server exactly.
- 10:38Speaker 1: If a million people are using WhatsApp and the process
- 10:41Speaker 1: handling my specific chat gets corrupted, Beam just quietly kills
- 10:46Speaker 1: my one process, cleans up my tiny piece of memory,
- 10:48Speaker 1: and leaves the other nine hundred and eighty nine thousand,
- 10:51Speaker 1: nine ninety nine chats running perfectly. Yes, the office manager
- 10:54Speaker 1: just fires the one confused worker and hires a replacement instantly,
- 10:59Speaker 1: without shutting down the building.
- 11:00Speaker 2: That isolation is exactly why telecom switches can boast nine
- 11:04Speaker 2: nines of reliability, nine nines meaning they are operational ninety
- 11:09Speaker 2: nine point nine nine nine nine nine percent of the time,
- 11:12Speaker 2: which amounts to just milliseconds of downtime per year.
- 11:16Speaker 1: That is insane. Okay, So we've got Bean playing the
- 11:18Speaker 1: ultimate office manager distributing all these isolated tasks across the hardware.
- 11:22Speaker 1: But how do we actually package the data we're sending
- 11:24Speaker 1: around this office?
- 11:25Speaker 2: Yeah? The data structures, Yeah.
- 11:26Speaker 1: Functions are strict about our dowdy. We need a foolproof
- 11:29Speaker 1: way to label and group our snapshots of truth and
- 11:31Speaker 1: Erlang handles this with two unique data types, atoms and tupples.
- 11:35Speaker 2: Atoms are the simplest building blocks, and atom is just
- 11:38Speaker 2: a lowercase word like earth, moon, okay, or error.
- 11:42Speaker 1: Right.
- 11:42Speaker 2: The philosophical mind bender for traditional programmers is that the
- 11:46Speaker 2: value of an atom is literally just its own text.
- 11:49Speaker 2: It doesn't represent a hidden integer or a memory address.
- 11:52Speaker 2: It just definitively equals itself.
- 11:54Speaker 1: And here's where it gets really interesting. Arlang commits to
- 11:58Speaker 1: this concept so deeply that even standard boolean logic values
- 12:03Speaker 1: true and false are just atoms.
- 12:05Speaker 2: Yeah, so elegant.
- 12:06Speaker 1: In almost every other language, boollians are special foundational types
- 12:10Speaker 1: wired into the core of the compiler, but in Erlang,
- 12:13Speaker 1: true and false are just lowercase words operated on by
- 12:16Speaker 1: specific logic operators like and also an or else.
- 12:19Speaker 2: It simplifies the language immensely, and atoms are incredibly memory efficient.
- 12:24Speaker 2: Beam stores all atoms in a central table. Okay, so
- 12:27Speaker 2: when you pass an atom between processes, you aren't passing
- 12:30Speaker 2: a heavy string of text. Beam is just passing a tiny,
- 12:33Speaker 2: lightweight pointer to that table index. It is blindingly fast.
- 12:37Speaker 1: Which totally makes sense when you pair with tuples. A
- 12:40Speaker 1: tuple is a way to group items together inside curly braces.
- 12:43Speaker 1: You open a curly brace, type the atom earth, comma
- 12:47Speaker 1: the number twenty, and close the brace. You get earth twenty.
- 12:51Speaker 1: A tuple is essentially a custom care package you hand
- 12:54Speaker 1: to a function. It contains a label, the atom, and
- 12:57Speaker 1: the actual payload data, which is the number.
- 12:59Speaker 2: And using an atom at the start of a tuple
- 13:01Speaker 2: is a vital, albeit informal convention in Erlang programming.
- 13:05Speaker 1: Yeah, it acts as a permanent, instant identifier for the
- 13:08Speaker 1: complex data structure you are passing.
- 13:10Speaker 2: Because Beam is routing millions of these packages a second,
- 13:13Speaker 2: the receiving function needs to instantly know what's inside the
- 13:17Speaker 2: box without having to open it up, parse the variables,
- 13:19Speaker 2: and analyze every piece.
- 13:21Speaker 1: The atom is like the bright red label on the
- 13:23Speaker 1: outside of the box. So if beam rounts the package
- 13:26Speaker 1: to my function and the label says error, I don't
- 13:28Speaker 1: need to parse the payload to know something went wrong.
- 13:31Speaker 2: You just see the label and immediately route it to
- 13:33Speaker 2: the air handling department exactly.
- 13:34Speaker 1: And that routing mechanism is the final piece of the puzzle.
- 13:38Speaker 1: We have our data packaged in tupples labeled with atoms,
- 13:41Speaker 1: but how does Erlang actually make decisions with them?
- 13:43Speaker 2: Because variables can't change.
- 13:45Speaker 1: Right, we can't use traditional if then statements that check
- 13:48Speaker 1: the state of a shifting variable.
- 13:50Speaker 2: No, you can't. Erlang replaces if then logic entirely with
- 13:53Speaker 2: pattern matching the.
- 13:55Speaker 1: Author's analogy for this. It's just brilliant, he says. Programming
- 13:58Speaker 1: in Erling is like playing pachinko and watching the balls
- 14:00Speaker 1: fall through a maze of pegs. Yes, or like making
- 14:03Speaker 1: a physical key whose teeth perfectly set the tumblers on
- 14:06Speaker 1: a lock. It is a highly mechanical process.
- 14:09Speaker 2: It is let's use the physics example from the source material.
- 14:13Speaker 2: We have a function calculating the velocity of an object
- 14:15Speaker 2: falling on different planetary mass objects or planemos. Okay, you
- 14:20Speaker 2: write different clauses for the function, and they're separated by
- 14:22Speaker 2: semi colons.
- 14:23Speaker 1: Right, So the first clause says, if the function receives
- 14:27Speaker 1: a tupple starting with the atom Earth in a distance,
- 14:31Speaker 1: apply the nine point eight gravity math semi colon exactly.
- 14:34Speaker 1: Then the next clause says, if the atom is Moon,
- 14:37Speaker 1: apply the one point six gravity math semiicolon. If it's Mars,
- 14:41Speaker 1: apply the three point seventy one math period to close
- 14:45Speaker 1: the function. Right, the data package drops in at the top.
- 14:48Speaker 1: It bounces off the Earth clause. If it doesn't match,
- 14:51Speaker 1: it falls to the Moon clause. If it matches there,
- 14:53Speaker 1: it clicks into place and executes the math.
- 14:55Speaker 2: But what happens if the data matches the pattern? Say
- 14:58Speaker 2: it has the Earth atom and a number, but the
- 15:00Speaker 2: number itself is toxic to the calculation.
- 15:03Speaker 1: Like passing the Earth atom, but giving a negative distance
- 15:06Speaker 1: of minus twenty meters, you can't dig a twenty meter hole.
- 15:10Speaker 1: Drop an object and watch it accelerate upward to the surface.
- 15:13Speaker 2: Exickly impossible, and mathematically, the velocity formula requires finding a
- 15:17Speaker 2: square root. Right, If you plug a negative distance in,
- 15:20Speaker 2: you are asking Erlang to find the square root of
- 15:23Speaker 2: a negative number. Without protection, the math fails, the function crashes,
- 15:28Speaker 2: and beam kills the process.
- 15:30Speaker 1: So how do we protect the tumblers in the lock?
- 15:33Speaker 1: I mean, we can't use an if statement to check
- 15:35Speaker 1: the number first?
- 15:36Speaker 2: No, we use guards?
- 15:37Speaker 1: Guards. Right.
- 15:38Speaker 2: You introduce a guard using the when keyword, so your
- 15:41Speaker 2: function clause doesn't just look for the earth atom. It
- 15:43Speaker 2: requires a match for earth and D when distance is
- 15:46Speaker 2: greater than or equal to zero.
- 15:48Speaker 1: So it safely bounces the toxic data out before the
- 15:51Speaker 1: math is even attempted. It ever, even enters the calculation phase.
- 15:55Speaker 2: Exactly if we connect this to the bigger picture, you know,
- 15:58Speaker 2: guards allow you to find your pattern matching based on
- 16:01Speaker 2: the actual content of the arguments, not just their shape. Right,
- 16:05Speaker 2: And there's one final critical piece to this pattern matching machinery,
- 16:09Speaker 2: explicitly ignoring data using the underscore character, which is known
- 16:13Speaker 2: as the don't care variable.
- 16:15Speaker 1: Oh, the don't care variable. I love this. So if
- 16:19Speaker 1: you are writing a piece of code that is strictly
- 16:21Speaker 1: earth centric, and another process sends you a tupple with
- 16:25Speaker 1: a planmo atom and a distance. You can write your
- 16:28Speaker 1: pattern match with an underscore in place of the atom.
- 16:30Speaker 2: Right.
- 16:31Speaker 1: You're basically telling the erline compiler, I don't care what
- 16:34Speaker 1: planet they sent. Don't waste memory binding it to a variable,
- 16:37Speaker 1: Just ignore it and give me the distance number.
- 16:39Speaker 2: It saves memory and processing cycles by only binding exactly
- 16:42Speaker 2: what is required for the calculation.
- 16:44Speaker 1: Let's apply this hallway of custom shaped doors metaphor to
- 16:47Speaker 1: something real like what'sapp.
- 16:49Speaker 2: Okay, let's do it.
- 16:50Speaker 1: Imagine millions of data tuples flying through beam. A tupple
- 16:54Speaker 1: comes down the hall labeled send message ye user ID text.
- 16:58Speaker 1: It flies past all the doors and till it perfectly
- 17:00Speaker 1: fits into the door designed to wrote text. A millisecond later,
- 17:04Speaker 1: a toupple labeled read receipt user ID flies down the hall.
- 17:08Speaker 1: It ignores the text door, falls further down, and slots
- 17:12Speaker 1: perfectly into the read receipt door.
- 17:13Speaker 2: It's completely seamless.
- 17:15Speaker 1: They're no bouncers checking IDs, no if then traffic cops
- 17:19Speaker 1: bottlenecking the hallway. The data just mechanically falls into the
- 17:22Speaker 1: exact physical shape it matches, or it gets kicked out entirely.
- 17:26Speaker 2: It is elegant, brutal, and unbelievably fast. It strips away
- 17:31Speaker 2: all the conditional clutter that bogs down object oriented languages,
- 17:35Speaker 2: allowing the system to route billions of messages without ever
- 17:37Speaker 2: getting confused about its state.
- 17:39Speaker 1: We've gone on quite a journey today. We've seen how
- 17:41Speaker 1: erlang completely strips away the ability to mutate a variable,
- 17:44Speaker 1: forcing you to rethink how data flows. We explored how
- 17:47Speaker 1: the Beam virtual machine acts as an invisible office manager,
- 17:51Speaker 1: handling all the messy hardware, logistics and process isolation. And
- 17:55Speaker 1: we unpacked how atoms, tipples, and pattern matching work together
- 17:58Speaker 1: to mechanically route data like a high speed Pachinko machine.
- 18:02Speaker 2: It requires a fundamental paradigm shift. I highly encourage you,
- 18:06Speaker 2: the listener, to reflect on your own work environment today. Yeah,
- 18:09Speaker 2: how much of your day is spent managing state.
- 18:12Speaker 1: Cracking, shifting variables, updating statuses, managing conflicting tasks.
- 18:16Speaker 2: Or trying to fix a project because someone altered a
- 18:19Speaker 2: shared spreadsheet while you were relying on it.
- 18:21Speaker 1: Oh, all the time.
- 18:22Speaker 2: Erlang proposes that managing state is inherently fragile. It argues
- 18:26Speaker 2: that by laying down uncompromising, rigid rules like a variable
- 18:30Speaker 2: that can never ever change, you actually grant yourself massive freedom, speed,
- 18:35Speaker 2: and reliability at an unbelievable scale.
- 18:38Speaker 1: So what does this all mean? We started by talking
- 18:40Speaker 1: about how Erling makes hard things easy and easy things hard.
- 18:43Speaker 1: Makes the simple intuitive act of counting impossible, right, but
- 18:47Speaker 1: it makes routing billions of simultaneous messages across a global
- 18:50Speaker 1: network virtually flawless.
- 18:52Speaker 2: I want to leave you with a final thought to
- 18:54Speaker 2: mull over. Okay, if Erling's single assignment, this uncompromising rule
- 18:59Speaker 2: that a variable can never change once defined, prevent so
- 19:02Speaker 2: many systemic crashes and bugs and computer networks, Well, what
- 19:06Speaker 2: would happen if we applied that exact same constraint to
- 19:09Speaker 2: human communication? Oh?
- 19:11Speaker 1: Wow, that is a wild thought.
- 19:13Speaker 2: Think about our legal systems or corporate business processes. What
- 19:18Speaker 2: if a defined term, a promise, or a task could
- 19:21Speaker 2: never be altered once it was spoken or written.
- 19:23Speaker 1: It could only be passed along to a new function,
- 19:25Speaker 1: creating a brand new term.
- 19:27Speaker 2: Exactly would it eliminate the miscommunications, the shifting goalposts, and
- 19:32Speaker 2: the race conditions that plague modern human organizations? Or you
- 19:36Speaker 2: would a rule that strict, completely grind human collaboration to
- 19:39Speaker 2: an absolute.
- 19:40Speaker 1: Halt, because, unlike a telecom switch, human beings sometimes need
- 19:43Speaker 1: things to be a little murky. We need the grace
- 19:46Speaker 1: to change our minds and overwrite our previous states. We do,
- 19:49Speaker 1: but it definitely makes you wonder if our default way
- 19:51Speaker 1: of working is fundamentally fragile. Something to think about the
- 19:54Speaker 1: next time you try to change it. Variable in your
- 19:56Speaker 1: own life,