You cannot change the value of self . It always points to the current object; you cannot point to anything else.
If you want to change the value of an object, you will either do this by calling other mutation methods, or by setting or changing the values โโof the instance variables, rather than trying to reassign self . However, in this case, this will not help you, because Float does not have any mutating methods, and setting instance variables will not buy you anything, because none of the float operations is by default affected by any instance variables.
So bottom line: you cannot write mutating methods in floats, at least not in the way you want.
sepp2k
source share