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

Absolutely.


Absolutely non-intuitive?


I think the point here is that you'd have to do something like this

  $x = new Number(1)
  $y = clone $x;
  $y->absolute();
to work with the absolute value of variable $x without actually changing $x


Yes, this is a common source of bugs when you're not sure what is changing. See below, someone suggests to use 'to' and 'as' prefix to convey immutable / mutable methods.




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

Search: