A Critical Error!!
-
Have you seen this before? http://blogs.msdn.com/samng/archive/2008/12/24/dynamic-in-c-vii-phantom-method-semantics.aspx[^] :^)
I died as a mineral and became a plant, I died as plant and rose to animal, I died as animal and I was Man. Why should I fear? When was I less by dying? -- Rumi[^] My blog
-
Have you seen this before? http://blogs.msdn.com/samng/archive/2008/12/24/dynamic-in-c-vii-phantom-method-semantics.aspx[^] :^)
I died as a mineral and became a plant, I died as plant and rose to animal, I died as animal and I was Man. Why should I fear? When was I less by dying? -- Rumi[^] My blog
I wouldn't call this 'critical'. Remember, the target method that's called is, in general, not determined until runtime if there are dynamic arguments. If the compiler doesn't know which method is going to be called, how should it check anything? In a few cases, the compiler is able to check some of the parameters; so the C# team decided to do that. It's unfortunate that they decided to not to implement all possible checks, but if you're delaying overload resolution until runtime, don't be surprised that some checks are not done at compile time! And remember that this "error" only occurs when there are phantom methods involved. If you're calling a method taking a dynamic parameter with a dynamic argument, that's a normal static call and constraints will be checked as expected. The "critical error" only occurs when calling a non-dynamic, generic, constrained method on a non-dynamic reference with dynamic arguments. Seems like a fringe case to me, and not critical at all.
-
I wouldn't call this 'critical'. Remember, the target method that's called is, in general, not determined until runtime if there are dynamic arguments. If the compiler doesn't know which method is going to be called, how should it check anything? In a few cases, the compiler is able to check some of the parameters; so the C# team decided to do that. It's unfortunate that they decided to not to implement all possible checks, but if you're delaying overload resolution until runtime, don't be surprised that some checks are not done at compile time! And remember that this "error" only occurs when there are phantom methods involved. If you're calling a method taking a dynamic parameter with a dynamic argument, that's a normal static call and constraints will be checked as expected. The "critical error" only occurs when calling a non-dynamic, generic, constrained method on a non-dynamic reference with dynamic arguments. Seems like a fringe case to me, and not critical at all.
Daniel Grunwald wrote:
not determined until runtime
For a compiler to not use information available to it, is no excuse! (perhaps they should go see what the F# guys are doing)
xacc.ide - now with TabsToSpaces support
IronScheme - 1.0 beta 2 - out now!
((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))