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. The "Default Interface Methods" (DIM) is now the longest thread of C# proposal

The "Default Interface Methods" (DIM) is now the longest thread of C# proposal

Scheduled Pinned Locked Moved The Lounge
csharpcomhelp
9 Posts 6 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.
  • R Offline
    R Offline
    Robert Vandenberg Huang
    wrote on last edited by
    #1

    Champion "default interface methods" · Issue #52 · dotnet/csharplang · GitHub[^]

    F realJSOPR N 3 Replies Last reply
    0
    • R Robert Vandenberg Huang

      Champion "default interface methods" · Issue #52 · dotnet/csharplang · GitHub[^]

      F Offline
      F Offline
      F ES Sitecore
      wrote on last edited by
      #2

      Default methods, great idea. If they switch .net to use binary interfaces this could be implemented by placing the default method at a pre-defined location of the interface, maybe the fourth entry in the interface so it's all standardised.

      1 Reply Last reply
      0
      • R Robert Vandenberg Huang

        Champion "default interface methods" · Issue #52 · dotnet/csharplang · GitHub[^]

        realJSOPR Online
        realJSOPR Online
        realJSOP
        wrote on last edited by
        #3

        If they want to add methods to interfaces, and if that doesn't break the multiple interface inheritance feature, why can't we inherit multiple classes as well?

        ".45 ACP - because shooting twice is just silly" - JSOP, 2010
        -----
        You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
        -----
        When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

        M 1 Reply Last reply
        0
        • R Robert Vandenberg Huang

          Champion "default interface methods" · Issue #52 · dotnet/csharplang · GitHub[^]

          N Offline
          N Offline
          Nathan Minier
          wrote on last edited by
          #4

          Yay, a new abstraction layer. Just what I needed in my day; not like I don't find myself editing out all the ones I inadvertently add already during the initial overthink. One day I should get YAGNI tattooed on the back of my hand :/

          "Never attribute to malice that which can be explained by stupidity." - Hanlon's Razor

          1 Reply Last reply
          0
          • realJSOPR realJSOP

            If they want to add methods to interfaces, and if that doesn't break the multiple interface inheritance feature, why can't we inherit multiple classes as well?

            ".45 ACP - because shooting twice is just silly" - JSOP, 2010
            -----
            You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
            -----
            When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

            M Offline
            M Offline
            Mladen Jankovic
            wrote on last edited by
            #5

            John Simmons / outlaw programmer wrote:

            why can't we inherit multiple classes as well?

            Because classes can have data and then you have diamond problem...

            realJSOPR 1 Reply Last reply
            0
            • M Mladen Jankovic

              John Simmons / outlaw programmer wrote:

              why can't we inherit multiple classes as well?

              Because classes can have data and then you have diamond problem...

              realJSOPR Online
              realJSOPR Online
              realJSOP
              wrote on last edited by
              #6

              It wasn't a "problem" in C++ - just sayin...

              ".45 ACP - because shooting twice is just silly" - JSOP, 2010
              -----
              You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
              -----
              When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

              M G 2 Replies Last reply
              0
              • realJSOPR realJSOP

                It wasn't a "problem" in C++ - just sayin...

                ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                -----
                You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                -----
                When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                M Offline
                M Offline
                Mladen Jankovic
                wrote on last edited by
                #7

                Many things weren't "problems" in C++, but I doubt C# designers want to take this route :)

                1 Reply Last reply
                0
                • realJSOPR realJSOP

                  It wasn't a "problem" in C++ - just sayin...

                  ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                  -----
                  You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                  -----
                  When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                  G Offline
                  G Offline
                  Gary Wheeler
                  wrote on last edited by
                  #8

                  It was much worse than a problem - it was a complication. If you've ever implemented COM in C++ or non-trivial owner-draw for MFC you have to be very aware of the complexities of multiple inheritance. I've done a lot of programming with C# over the last ten years. There have only been a couple of times where something would have been more concise using multiple inheritance, rather than single inheritance and multiple interfaces.

                  Software Zen: delete this;

                  realJSOPR 1 Reply Last reply
                  0
                  • G Gary Wheeler

                    It was much worse than a problem - it was a complication. If you've ever implemented COM in C++ or non-trivial owner-draw for MFC you have to be very aware of the complexities of multiple inheritance. I've done a lot of programming with C# over the last ten years. There have only been a couple of times where something would have been more concise using multiple inheritance, rather than single inheritance and multiple interfaces.

                    Software Zen: delete this;

                    realJSOPR Online
                    realJSOPR Online
                    realJSOP
                    wrote on last edited by
                    #9

                    In MFC, you could only multiple inherit if only one of the classes being inherited was not derived from CObject. The reason it can't be done in .Net is that ALL objects are inherited from Object, and there's no way to avoid it. They could easily fix it with an attribute, but no, they'd rather adhere to their arbitrary restrictions.

                    ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                    -----
                    You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                    -----
                    When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                    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