|
![](/i/fill.gif) |
>> (And besides, any kind of detection of this cannot be 100% accurate,
>> as the problem "will this line of code ever be reached?" is unsolvable
>> in the general case.)
>
> But detecting type errors isn't 100% accurate either.
>
> int x = 1 ? 5 : "hello";
>
> That's not legal, but it's not a type violation either.
The general problem of determining whether every possible code path is
well-typed is undecidable. Type systems insert artificial restrictions
to /make/ the problem decidable. Hence, there are expressions and
statements which are well-typed, but do not type-check.
Post a reply to this message
|
![](/i/fill.gif) |