|
|
|
|
|
by unilynx
2520 days ago
|
|
Or just use strings. That's what we do for basic webshop math - any naive attempt at doing eg a multiplication will break, requiring you to use the supplied math library (just like with objects...) But: with strings you still have pass-by-value. So you can pass the values anywhere without worrying that whoever received the values will be modifying your object. And we still have the infinite range that integers can't give, which is especially useful when doing the multiplications for VAT and coupon codes etc.. The only remaining danger is that '+' works on strings, but we should notice those fast enough - it hasn't been a real issue yet. (And if we need to start optimizing things at some point, I'd expect to have a better starting point when the data is already in a string than if we have to copy around objects all the time) |
|