martin

martin

Where did the name Elixir come from?

I came across a reference to Potion, the language by _why the lucky stiff. It got me thinking that maybe Elixir is a nod and homage to _why. But I realised I don’t know the origin of the name Elixir.

Showing Posts 36 to 27

StefanHoutzager

StefanHoutzager

It wouldn’t surprise me. Dahl loved a beer (stout?) in his favourite pub “the old swan” I saw in a documentary. Maybe he met these men there too: “There was only one disaster. Three silly men who had drunk too much beer for lunch decided to climb over the high fence surrounding the pit, and of course they fell in. There were yells of delight from the giants below, followed by the crunching of bones.” (bfg)

ardhitama

ardhitama

Owh.. come on… it must be have some meaning no? Considering elixir is a cult right now. :laughing:

*jk

alzearafat

alzearafat

When I google elixir, at least I comes to these results :

  • Elixir as programing language
  • Elixir as potion on a game
  • Elixir as a guitar string
  • Elixir as a one of Laravel feature

:laughing: :laughing: :laughing:

But I think Elixir name is cool!

davearonson

davearonson

So Guinness is frobscottle? See Do bubbles in Guinness go down? for some enlightening explanation.

StefanHoutzager

StefanHoutzager

It won’t come from here but somehow elixir reminds me of frobscottle, an invention from Roald Dahl.

In The BFG, he describes frobscottle, a fizzy drink where 
the bubbles fizz downwards instead of up. Upward-fizzing bubbles 
make one burp, something the giants in the book find ‘filthsome’. 
Sophie, the heroine, takes issue with the alternative.

“With frobscottle,” Sophie said, “the bubbles in your tummy 
will be going downwards and that could have a far nastier 
result.”
“Why nasty?” asked the BFG, frowning.
“Because,” Sophie said, blushing a little, “if they go down
instead of up, they’ll be coming out somewhere else with an
even louder and ruder noise.”
“A whizzpopper!” cried the BFG, beaming at her.
“Us giants is making whizzpoppers all the time! Whizzpopping is
a sign of happiness. It is music in our ears! You surely is not
telling me that a little whizzpopping is forbidden among human 
beans?”
“It is considered extremely rude,” Sophie said.
“But you is whizzpopping, is you not, now and again?” asked
the BFG.
“Everyone is whizzpopping, if that’s what you call it,” 
Sophie said. “Kings and Queens are whizzpopping. Presidents
are whizzpopping. Glamorous film stars are whizzpopping.
ittle babies are whizzpopping. But where I come from,
it is not polite to talk about it.”
“Redunculous!” said the BFG. “If everyone is making whizpoppers,
then why not talk about it? We is now having a swiggle of
this delicious frobscottle and you will see the happy result.”
The BFG shook the bottle vigorously. The pale green stuff 
fizzed and bubbled. He removed the cork and took a 
tremendous gurgling swig.
“It’s glummy!” he cried. “I love it!”
For a few moments, the Big Friendly Giant stood quite still, 
and a look of absolute ecstasy began to spread over his
long wrinkly face. Then suddenly the heavens opened and
he let fly with a series of the loudest and rudest noises 
Sophie had ever heard in her life. They reverberated around
the walls of the cave like thunder and the glass jars rattled 
on their shelves. But most astonishing of all, the force of the 
explosions actually lifted the enormous giant clear off his
feet, like a rocket.
“Whoopee!” he cried, when he came down to earth again.
“Now that is whizzpopping for you!”
(Roald Dahl – The BFG 1982)
OvermindDL1

OvermindDL1

I usually pattern match myself, consider these two cases:

myVar = someFunction("blah")

# Case 1
first = List.first(myVar)

# Case 2
[first|_] = myVar

# Case 3
case myVar do
  [first|_] -> useFirst(first)
  [] -> doOtherwise()
end

Case 1 is using List.first, it works.
Case 2 is pattern matching, same as Case 1 but I like it as it makes it explicit what it is doing.
Case 3 is a case statement, longer sure, but the usage of the match is handled and if the list is empty that is also handled.

However, what if myVar was nil? Maybe even through no fault of someFunction/1 but rather some other call or so. Cases 1 and 2 and 3 all crash.

A statically typed system on the other hand has to know what is returned, like given this equivalent OCaml code:

let myVar = someFunction "blah" in

(* Case 1 *)
let first = List.hd myVar in

(* Case 2 *)
let first::_ = myVar in

(* Case 3 *)
match myVar with
| first::_ -> useFirst first
| [] -> doOtherwise ()

Given someFunction "blah" can only return a list (otherwise it throws an exception if an exceptional condition):

  • Case 1 → Compiles and works as expected, returns first as first else throws an exception.
  • Case 2 → Compiles and works as expected, returns first as first else throws an exception.
  • Case 3 → Compiles and works as expected, you handle all paths.

However, given someFunction "blah" can return a list or () (Ocaml’s version of nil) as a Result.t or just an option, say because of an internal refactor later on in the project and the above original code was missed in the update, then:

  • Case 1 → Will not compile, List.first only accepts a variable that can only be a nil
  • Case 2 → Will not compile, the match construct cannot match anything of myVar, have to decompose the option.
  • Case 3 → Will not compile, the match construct cannot match anything of myVar, have to decompose the option.

You either have to withDefault the option/result to a default value to get back to the original handling, or you have to handle the option properly. In either case in a dynamic language this is missed and will crash sometime later (hopefully in tests, most likely in prod, especially if the tests do not test a nil case because there was no nil case originally). Dialyzer ‘might’ catch this if all paths can be confirmed, but that cannot be guaranteed. :slight_smile:

terakilobyte

terakilobyte

Agreed. And you are correct, XCode showed a warning on that line of code. Just playing a bit. So far in my Elixir adventures I’ve yet to try to access an item by index. I either filter down or use List.first/1 or List.last/1

OvermindDL1

OvermindDL1

Heh, though using a decent C/C++ compiler that would be caught since you are using constant values and you’d get a warning, where elixir gives nothing. ^.^

Not that elixir is bad at all, most fully typed languages would not get this either without dependent types support (I.E. not Haskell/OCaml/Elm/etc… very few languages have dependent types, although you can emulate them with OCaml’s modules, they are near unrepresentable in Haskell), just it is a folly to consider it a solved problem. ^.^

terakilobyte

terakilobyte

True, true. But at least it returns nil, vs something like

int main() {
  int test[4] = {1, 2, 3, 4};
  printf("%d\n", test[4]); // Yea, though I walk through the valley of the shadow of death
}
Onor.io

Onor.io

I have to thank you for rekindling my interest in looking at OCaml. I had forgotten how much I like the syntax and with an option like Bucklescript I don’t even have to feel guilty about not wrestling with JavaScript. :slight_smile:

Where Next? Top

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2977 94592 917
New
cblavier
Hey there, It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
heathen
Quite interesting article Google brought me. Didn’t find any mentions about it here. What do you think in general? Would you use togethe...
New
maennchen
:warning: Security advisory: Decimal DoS vulnerability A vulnerability has been published for decimal where very large exponents can cau...
New
marciol
It would be helpful to have a list of companies worldwide that hire engineers without prior experience in Elixir. Often, it can be quite ...
New
durvia
Anyone running long-lived stateful processes on BEAM? We’re building an AI agent runtime and would love to compare notes. We’re a small ...
New

Other Trending Topics Top

marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
webofbits
Aludel - LLM Evaluation Workbench Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews