|
Am 16.07.2016 um 22:44 schröbte Soni L.:
I'm not sure what your point here is.
My point is still:
Doing the interning and equivalence class thing during construction of your bigints instead of during table indexing has the added advantage, that `100 == bigint(100)` works as well, that something like `table.insert({}, bigint(1), x)` works as well, and that it's probably also faster.
But in the interest of avoiding infinite recursion I'll add that making values of two separate types equivalent to each other may lead to situations where you get one type of operation when you intended the other kind, and that it's more likely to happen when you do the interning during construction. The only way to prevent it completely is to use separate operators (very much like string concatenation `..` doesn't re-use the `+` operator). Since you can't add new operators to Lua, that usually means functions.
Philipp