|
![](/i/fill.gif) |
On 4/20/2012 1:07, Invisible wrote:
>>> (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.
Which is the point I'm making. We put up with saying "that'll never be the
wrong type, but it's still illegal", so the argument that "whether this code
is reachable is unsolvable, so we shouldn't even try" is equally bogus.)
--
Darren New, San Diego CA, USA (PST)
"Oh no! We're out of code juice!"
"Don't panic. There's beans and filters
in the cabinet."
Post a reply to this message
|
![](/i/fill.gif) |