News for hackers. Stuff that matters.
Re:What is type safety? by cousin_it on Tuesday August 05, 2014 @01:21PM (#8138084)
So type safety is just a synonym for "no undefined behavior"? What about code like "i=i++", which leads to undefined behavior but doesn't seem to have any type errors? I thought type safety referred to only a subset of undefined behaviors, namely using a value of type A as though it had type B.
Re:What is type safety? by AnimalMuppet on Tuesday August 05, 2014 @01:27PM (#8138109)
This seems to be C/C++ code. The article said that C and C++ were not type safe, so "doesn't seem to have any type errors" within C/C++ doesn't mean that it's type safe.

That said, the article did say that Java was type safe, and you can write that same expression in Java. I don't recall whether the result is undefined in Java.

Re:What is type safety? by cousin_it on Tuesday August 05, 2014 @01:37PM (#8138186)
As far as I know, Java has no undefined behavior in the C/C++ sense (nasal demons), and "i=i++" is well defined in Java.
Re:What is type safety? by tel on Tuesday August 05, 2014 @01:35PM (#8138172)
Type safety isn't just "no undefined behavior", but it cannot possibly exist in the presence of undefined behavior.