Re:OTP at a High Level (2019)
by dudinax on Monday February 19, 2024 @09:07PM
(#39437227)
This would make me choose erlang over Elixer. It's convenient to find an assignment to a variable and not have to worry there might be another.
[ Parent
| on HN ]
I've worked with both extensively and I agree that Elixir's rebinding is a bit of a wart. FWIW you can get the Erlang behaviour by using the "pin" operator:
iex(1)> x = 4
4
iex(2)> ^x = 3
** (MatchError) no match of right hand side value: 3Yep, I can see why someone would prefer preventing shadowing even though I don't. I just wanted to be clear on what the actual behavior was.
Re:OTP at a High Level (2019)
by sodapopcan on Tuesday February 20, 2024 @12:48PM
(#39444329)
It really isn't a problem... like, at all as it only affects variables within the same scope.
foo = "Hello"
if true do
foo = "Bye!"
end
foo # `foo` is still "Hello" here
I guess if you have REALLY long functions it could be ¯\_(ツ)_/¯