is type checking in D undecidable?

Dennis dkorpel at gmail.com
Thu Oct 22 18:43:32 UTC 2020


On Thursday, 22 October 2020 at 17:25:44 UTC, Bruce Carneal wrote:
> Is type checking in D undecidable?  Per the wiki on dependent 
> types it sure looks like it is.

It is indeed undecidable. Imagine you had a decider for it. 
Because CTFE is clearly turing-complete, you can express that in 
a D function `bool typeChecks(string code)` and then do this 
(similar to the halting problem):
```
enum int x = typeChecks(import(__FILE__)) ? "abc" : 100;
```


More information about the Digitalmars-d-learn mailing list