Re:Hyperpolyglot: PHP, Perl, Python, Ruby
by adyus on Saturday August 13, 2011 @08:22PM
(#2882371)
As a Ruby noob and without researching too much, here's my question: would x.succ! do it?
[ Parent
| on HN ]
Re:Hyperpolyglot: PHP, Perl, Python, Ruby
by petercooper on Saturday August 13, 2011 @11:10PM
(#2882674)
Not if x were a regular old Fixnum.
The reason is that x would be referring to a number like 1, 42, or whatever, and numbers are immutable in Ruby. You can't "change" a number in-place. If you could change Ruby's concept of 1 into 2, then 1 would cease to exist and that would be a Bad Thing™ :-)