2015-03-04 12:07 GMT+01:00 Nicolas Cellier < [email protected]>:
> > > 2015-03-04 10:18 GMT+01:00 [email protected] <[email protected]>: > >> >> Le 4 mars 2015 10:03, "Sven Van Caekenberghe" <[email protected]> a écrit : >> >> > >> > Here is an article complaining about Integer types in Swift. >> > >> > Swift: Madness of Generic Integer >> > >> > >> http://blog.krzyzanowskim.com/2015/03/01/swift_madness_of_generic_integer/ >> > >> > Really, those statically typed languages are soo much better. >> > > The article is interesting. > To translate it in Smalltalk terms, it's as if we would like to decline > the SmallInteger into several subtypes... > Of course we would not want to do that, because complexification would > much probably result in a slower VM! > > 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 >> > >> > >
