Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


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: 3


Yep, 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.


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 ¯\_(ツ)_/¯




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: