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

He's saying to use = instead of <- because it won't let you assign to a variable there. But that's because it assumes you mistyped the equality operator. The only reason you need safety there is because it's easy to forget that == is the equality operator, not =. It's not easy to confuse == and <-.


The danger is that you can intend to type

  if(b < -9) 
and instead type

  if(b <- 9)
The latter always evaluates to true and assigns the value you're trying to compare with to your variable. This can be extremely difficult to catch and detect, especially for people who aren't software developers. They aren't writing unit tests.




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

Search: