That said, I once considered the possibility of having a PositiveSmallInteger and a NegativeSmallInteger just for the sake of unifying the sign/magnitude handling.
But, let's imagine that it can pay..
We can also transpose this to collections - ByteArray ShortIntegerArray WordArray with signed/unsigned variants - without resorting to VM considerations...
Are we sure that Smalltalk implementation (image side) would be simpler than Swift with all the double dispatching machinery involved?
So, if the goal of having such space/time optimization is founded (which we can't know without context), I would say Swift does not do it that bad...
Some languages are much worse, like say:
https://www.securecoding.cert.org/confluence/display/c/INT32-C.+Ensure+that+operations+on+signed+integers+do+not+result+in+overflow
;)Thx for the share. Enlightment doesn't come easy.
Remember that a lot of code in this world is still COBOL...
Phil
>
> Sven
>