AstonJ
When you see code like this:
name = "José"
How do you read it in your mind?
In Ruby I would read it as:
name, is set to, José
In Elixir I’m not sure whether to read it as:
name, match, José
or
name, equals, José
How do you refer to it? Is there a ‘correct’ way?
Trending in Discussions
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...
New
I want to open this thread for you all to discuss and help those who really like Ash but are still hesitant to use it in a real project. ...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
I’m posting this in response to Jose’s recent tweet (Cr. link) :
People are sleeping on Elixir for a coding harness:
Hot-code swappi...
New
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
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
This might be a bit disturbing for some but it’s happening - computers running on living human neurons. They’ve made them smart enough t...
New
Other Trending Topics
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
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
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
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Aludel - LLM Evaluation Workbench
Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #ai
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
NobbZ
When there is just a single name, I do read it as “name is set to value of expression” while I do read it as “pattern is applied to expression”. I try to avoid to use “pattern matches expression” to avoid confusion with
===, which I often read as “left matches right”.kelvinst
Yep, I would say
name is set to Joséas well as in Ruby for single assignments. I know it’s not an assignment, but it’s easier to say, and comparing to other languages, the final result is the same of an assignment.I never thought about compex pattern matching like:
But I guess the @NobbZ suggestions it’s pretty clear, the code could be described like:
Reading it afterwards, it feels very complex at the first glance (compared to imperative code when described), but I guess that someone with a little bit of experience in FP will understand everything, and will mentally compile it to the explained code.
peerreynders
Anything wrong with
"José"is bound toname?jmitchell
Pedantically, “set to” feels strange because it suggests trivial assignment without pattern matching. Like @NobbZ said, “match” could be confused with a strict equivalence check.
Elixir’s pattern matching is enabled by a unification algorithm, so what do you all think of “x unified with y”?
sotojuan
I like “bound” too. Simple and understandable.
AstonJ
Here’s a another one to throw in the mix:
From this video.
After watching that video, I am leaning towards just saying:
And just being aware that the operator can be used to assign variables as well as other things/pattern match - because they all boil down to making both sides the same/equal.
I’m also leaning towards this because
and calling it that just seems to make sense. (Can anyone remember when we first told to refer to the
)
=is in fact the equals sign=sign asis set to- I distinctly remembering thinking that that’s weird, it doesn’t mean that it means equals!sztosz
I think that it’s wrong question. I doubt you really translate in your mind
=sign to a spoken word or phrase. I’m thinking in terms of symbols when I see symbols. Just like my native language being Polish, I don’t translate English text to Polish when I read it. And just as I read and think in English when dealing with English test, people etc. I think in “Programming” in general or “Elixir” in specific when I deal with Elixir code.But If I was to read aloud this to someone I’d probably choose equals.
peerreynders
You are absolutely correct when it comes to the isolated character or symbol. But

name = "José"puts that character in a context - and context can change everything.kelvinst
Well, thinking a little bit more about it, maybe we, programmers, are just addicted to the verb “to set”. If we get back to our math classes, we would find ourselves describing
x = 1 + 2as “x equals to one plus two”.EDITED
Yes, it conflicts with
==but I guess the context should give “equals” the meaning in this cases. For exampleif (a == b), do: IO.puts("hi")would be described as “if a equals b prints ‘hi’” and we would totally understand.And in the conflicting cases like
x = (a == b)it could be described like “x equals the value of the boolean expression ‘a equals b’”.AstonJ
I do
if I am reading through code and the sign is a standard character (so not something like
->or~>) I automatically read it as such.I’m not really keen on referring to it as different things in different contexts tbh (particularly as it might confuse newbies).
I think acknowledging/explaining that it does different things in different contexts is probably fine, particularly since it more or less does the same thing; it makes equal or tries to make equal both sides. What do you think?
I don’t think there’s a conflict as that’s two together, which I think makes us more attuned and open to accepting that it means something different (similar or related perhaps, but different). Agree?