News for hackers. Stuff that matters.
Re:Chris Lattner on Swift and dynamic dispatch by bjourne on Sunday December 13, 2015 @09:12AM (#10726375)
Unbounded integers are much slower than wrap-around integers that C uses. So, unless you are comparing some kind of Swift int64 type with C ints, you are comparing apples to oranges. The reason is that for every "x + 1" expression, Swift has to ensure that the value doesn't overflow the size of a hardware register. C of course has no such qualms.
Re:Chris Lattner on Swift and dynamic dispatch by mpweiher on Sunday December 13, 2015 @11:32AM (#10726767)
So integers are also not in the 'restricted subset'? Like arrays? Ooookay...

Anyway, Swift's integers are not unbounded, just checked.

Re:Chris Lattner on Swift and dynamic dispatch by bjourne on Sunday December 13, 2015 @12:02PM (#10726894)
I don't know. Apparently integer arithmetic can cause overflow exceptions which I assume requires the runtime environment which would be outside of the restricted subset. I don't think Swift can be used to profitably write a bootloader but we'll see.
Re:Chris Lattner on Swift and dynamic dispatch by alblue on Sunday December 13, 2015 @05:21PM (#10728230)
The operation + on integer types maps to a built in method which performs addition with overflow checks. At the assembly level this looks like an "add" followed by a "jo" (jump on overflow set) to an undefined exception such as UD2.

If you want wraparound addition you can use +& which removes the overflow check.

Re:Chris Lattner on Swift and dynamic dispatch by mpweiher on Sunday December 13, 2015 @03:24PM (#10727757)
Exceptions can't be caught in Swift, so not much runtime needed except an interface to kill(2) or plain old exit. :-)