3 ms·
In the general case, the compiler can't check to see that that code is incorrect. Consider the case in which the boolean result "x == nil" is threaded around fr
by pcwalton 14y ago
In the general case, the compiler can't check to see that that code is incorrect. Consider the case in which the boolean result "x == nil" is threaded around from function to function, aliased (you handed out a pointer to it), etc... Also consider the case in which "x" is aliased (you handed out a pointer to it) and it gets mutated to nil in the middle of the branch by calling some function.
If you go down this road, you end up making the compiler perform a very difficult (probably undecidable) proof. There has been lots of research on this and it's not easy...
- drivebyacct2 14y agoSorry, this may be becoming off-topic, and to be honest, I'd considered multithreading (especially given Go's strong suite). Is that just not something Haskell or equivalent can do then?
- Peaker 14y agoWhat do you mean? How does this relate to multithreading?