4 ms·
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.
by dudinax 3y ago
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.
- sodapopcan 3y agoIt 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 ¯\_(ツ)_/¯
- lolinder 3y agoYep, 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.
- sbrother 3y agoI'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: 3