Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. A Critical Error!!

A Critical Error!!

Scheduled Pinned Locked Moved The Lounge
csscomtoolsxmlhelp
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Pedram Behroozi
    wrote on last edited by
    #1

    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

    D 1 Reply Last reply
    0
    • P Pedram Behroozi

      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

      D Offline
      D Offline
      Daniel Grunwald
      wrote on last edited by
      #2

      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.

      L 1 Reply Last reply
      0
      • D Daniel Grunwald

        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.

        L Offline
        L Offline
        leppie
        wrote on last edited by
        #3

        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))

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups