[Mathlib-develop] Should NumberToken be immutable?
Status: Beta
Brought to you by:
st_mueller
From: mark <msp...@ya...> - 2003-02-12 17:39:20
|
At the moment when executing num1 <op> num2 the system sometimes modifies= num1=20 and sometimes creates a new NumberToken. I've been thinking that it might be better if NumberTokens were immutable= so=20 that all operations returned a new object without changing either operand= =2E The advantages are 1: constants can be used in place of common numbers (-1,0,1,i) 2: this will reduce the need for functions to clone there parameters befo= re=20 operating on them=20 3: it'll reduce the chance of bugs becuase of having two references to a=20 number that suddenly changes The disadvantages are 1: It might slow some operations down So what does everyone think about this? Best Regards Mark |