Is C # 4.0 compiling ready?

There is a well-known fact that C ++ templates complete completion , CSS completes completion (!), And that C # has NP-hard overload resolution (even without generics).

But is C # 4.0 (with co / contravariance, generics, etc.) turing time compilation complete ?

+6
source share
1 answer

Unlike templates in C ++, generics in C # (and other .net langs) are a generated runtime. The compiler does some validation to verify the use of types, but the actual replacement happens at runtime. The same goes for Co and contravariance, if I'm not mistaken , as well as the preprocessor directive . A lot of magic CLR.

(At the implementation level, the main difference is that C # substitutions of a general type are performed at runtime and the generic type is thus saved information for object instances)

See MSDN

http://msdn.microsoft.com/en-us/library/c6cyy67b (v = vs .110) .aspx

Update: CLR performs preform type checking through information stored in metadata related to compiled assemblies ( Vis-ร -vis Jit Compliation ), it does this as one of its many services, ( ShuggyCoUk answer on this explains this in detail ) (others include memory management and exception handling). Thus, I would conclude that the compiler understands the state as a progression and state, as in the internal state of the machine ( TC , in part, means the ability to display data (characters) with reference to previous data (characters), conditionally and evaluation) ( I did not dare to indicate the exact value of TC as I myself am not sure that I have it fully grasped, so do not hesitate to fill in the gaps and correct me, when applicable). So, I would say with a little trepidation, yes, yes, it can be.

+2
source

Source: https://habr.com/ru/post/923022/


All Articles