Loading ...
Sorry, an error occurred while loading the content.

RE: [ASCOM] C# 4.0 interesting stuff

Expand Messages
  • Mel Bartels
    C#4.0 is advertising the introduction of dynamic late binding. The devil is in the details and C#4.0 isn t reality yet, so expect change! Mel Bartels From:
    Message 1 of 10 , Oct 31, 2008
    • 0 Attachment

      C#4.0 is advertising the introduction of dynamic late binding.   The devil is in the details and C#4.0 isn’t reality yet, so expect change!

       

      Mel Bartels

       

       

       

      From: ASCOM-Talk@yahoogroups.com [mailto:ASCOM-Talk@yahoogroups.com] On Behalf Of Ray Gralak
      Sent: Friday, October 31, 2008 1:01 PM
      To: ASCOM-Talk@yahoogroups.com
      Subject: RE: [ASCOM] C# 4.0 interesting stuff

       

      Hi Tim,

      If C# really improves its late binding support in V4.0 then that would
      probably make it my new language of choice for projects that have to use
      late bound COM interop (for me VB.Net holds that spot for now).

      -Ray

      > -----Original Message-----
      > From: ASCOM-Talk@yahoogroups.com
      > [mailto:ASCOM-Talk@yahoogroups.com]
      On Behalf Of Tim Long
      > Sent: Friday, October 31, 2008 7:31 AM
      > To: ASCOM-Talk@yahoogroups.com
      > Subject: RE: [ASCOM] C# 4.0 interesting stuff
      >
      > Yes, agreed. There is an example of just that on the blog
      > post I linked to. Scott Hanselman did a post a while back
      > (http://www.hanselman.com/blog/BackToBasicsVarDim.aspx
      > <http://www.hanselman.com/blog/BackToBasicsVarDim.aspx>
      ) in
      > which he clearly demonstrates that VB is much better at doing
      > the late binding, the VB code is 13 lines and the equivalent
      > C# code is about 60 lines. Like pulling teeth. Having been to
      > the dentist this morning I speak with some authority on that
      > ;-) In Chris' post, he shows how C# 4.0 dynamic types
      > essentially levels the playing field by hiding all the late
      > binding mechanics, like VB does. Yes, COM Interop is still
      > there, you can write the 60 lines if you like, but soon you
      > will not need to. For the C# developer, that will be good
      > news, even if only because we will not have to put up with VB
      > developers teasing us about how bad C# is at late binding ;-)
      >
      > Tim Long, Owner & Technology Consultant
      > TiGra Networks - The Small Business IT Specialists
      > 01443 208678 | www.tigranetworks.co.uk
      >
      >
      > -----Original Message-----
      > From: ASCOM-Talk@yahoogroups.com
      > <mailto:ASCOM-Talk%40yahoogroups.com>
      > [mailto:ASCOM-Talk@yahoogroups.com
      > <mailto:ASCOM-Talk%40yahoogroups.com> ] On Behalf Of Ray Gralak
      > Sent: 31 October 2008 13:44
      > To: ASCOM-Talk@yahoogroups.com
      <mailto:ASCOM-Talk%40yahoogroups.com>
      > Subject: RE: [ASCOM] C# 4.0 interesting stuff
      >
      > Tim,
      >
      > > No more COM Interop. Yay!
      >
      > COM interop is not going away. It's just looks like maybe C#
      > is finally implementing a feature to support late binding
      > like what VB.Net/VB6 have been doing for years. Welcome to
      > the 21st century, C-Sharp! :-)
      >
      > -Ray
      >
      > > -----Original Message-----
      > > From: ASCOM-Talk@yahoogroups.com
      > <mailto:ASCOM-Talk%40yahoogroups.com>
      > > [mailto:ASCOM-Talk@yahoogroups.com
      > > <mailto:ASCOM-Talk%40yahoogroups.com> ] On Behalf Of Tim Long
      > > Sent: Friday, October 31, 2008 6:17 AM
      > > To: ASCOM-Talk@yahoogroups.com
      <mailto:ASCOM-Talk%40yahoogroups.com>
      > > Subject: [ASCOM] C# 4.0 interesting stuff
      > >
      > > With PDC happening this week lots of details are starting to emerge
      > > about upcoming Microsoft product releases. C# 4.0 may be the most
      > > interesting to some ASCOM developers and those interested in
      > > architectural issues. One thing I thought was particularly
      > interesting
      > > was this excerpt regarding the new 'dynamic' type that is being
      > > introduced (from Chris Burrows'
      > > blog
      > >
      > <http://blogs.msdn.com/cburrows/archive/2008/10/27/c-dynamic.a
      > spx
      > <http://blogs.msdn.com/cburrows/archive/2008/10/27/c-dynamic.a
      spx> > ):
      > >
      > >
      > >
      > > This allows you to use the C# language, with the brevity and syntax
      > > you've become accustomed to, to invoke methods on python or ruby
      > > objects, or on any COM IDispatch object, even without an interop
      > > assembly, or on any other object that "knows how to
      > dispatch itself"
      > > (you could imagine, say, a DOM that uses this to expose its
      > content as
      > > properties). And you can do this on regular old .NET objects too.
      > >
      > >
      > >
      > > No more COM Interop. Yay!
      > >
      > >
      > >
      > > Best regards,
      > >
      > > Microsoft Most Valuable ProfessionalTiger Relief.png
      > >
      > > Tim Long
      > <http://community.tigranetworks.co.uk/blogs/Tim_Long
      > <http://community.tigranetworks.co.uk/blogs/Tim_Long> >
      > >
      > > Owner & Technology Consultant
      > >
      > > TiGra Networks
      > > <
      href="http://community.tigranetworks.co.uk/blogs/TiGraNetworks/">http://community.tigranetworks.co.uk/blogs/TiGraNetworks/
      > <http://community.tigranetworks.co.uk/blogs/TiGraNetworks/> >
      > >
      > > The Small Business IT Specialists
      > >
      > > 01443 208678 | www.tigranetworks.co.uk
      > > <http://www.tigranetworks.co.uk
      <http://www.tigranetworks.co.uk>
      >
      > >
      > >
      > >
      > >
      > >
      > >
      > >
      >
      > ------------------------------------
      >
      > For more information see http://ASCOM-Standards.org/.
      > <http://ASCOM-Standards.org/.>
      >
      > To unsubscribe from this group, send an email FROM THE
      > ACCOUNT YOU USED TO SUBSCRIBE(!) to:
      > ASCOM-Talk-unsubscribe@yahoogroups.com
      > <mailto:ASCOM-Talk-unsubscribe%40yahoogroups.com>
      >
      > Yahoo! Groups Links
      >
      >
      >
      >
      >



      __________ NOD32 3573 (20081031) Information __________

      This message was checked by NOD32 antivirus system.
      http://www.eset.com

    • Bob Denny
      ... The back story is that this is another affirmation that COM as part of the Windows OS is not only here to stay, it s finally getting its recognition in the
      Message 2 of 10 , Nov 4, 2008
      • 0 Attachment
        Further musings:
        This allows you to use the C# language, with the brevity and syntax you've become accustomed to, to invoke methods on python or ruby objects, or on any COM IDispatch object, even without an interop assembly, or on any other object that "knows how to dispatch itself" (you could imagine, say, a DOM that uses this to expose its content as properties). And you can do this on regular old .NET objects too.

        The back story is that this is another affirmation that COM as part of the Windows OS is not only here to stay, it's finally getting its recognition in the bastion of "managed or bust" -- the C# community.

        That little ditty above about a DOM exposing itself is not a dream, it's already reality and has been for a while. Same goes for a script (not a compiled/managed/JS.NET script... i mean one of the interpreted languages that play on WSH) - once parsed by the scripting engine it's innards are available as a dispatch object. Now that's cool! There's so much more and it's all there, mature, and really powerful.

          -- Bob



      • Bob Denny
        More interesting info from Dare Obasanjo - C# is the Next Python: Duck Typing and C# 4.0
        Message 3 of 10 , Nov 13, 2008
        • 0 Attachment
          More interesting info from Dare Obasanjo - C# is the Next Python: Duck Typing and C# 4.0. One of the things I love about Javascript is its "duck typing" - though I confess to having never heard of the term till I read Dare's article. It looks like late binding is becoming more appreciated in the .NET world. It's benefits were what drove the original "late binding only" decision I made back in 1999. Anyway, for those of you who are software authors this article might be interesting...

            -- Bob

        • Tim Long
          Interesting. Windows PowerShell already does that stuff really well. Using PowerShell, I believe (though I haven t tried it) you can even take a .NET or COM
          Message 4 of 10 , Nov 13, 2008
          • 0 Attachment

            Interesting. Windows PowerShell already does that stuff really well. Using PowerShell, I believe (though I haven’t tried it) you can even take a .NET or COM object, create an instance of it, then add properties and methods to that object at runtime (the properties and methods aren’t really added to the object, it is just a syntactic trick done by PowerShell, as are a lot of the C# 3.0 enhancements like anonymous types and auto-properties).

             

            “Duck typing” is an uncomfortable concept for me, because I really like the strict typing of C# and I think it results in clean, readable code. Others share some of my concerns. I can’t help wondering if dynamic types in C# is just going to open the flood gates to a lot of really dicey code. However, there are clearly times when dynamic behaviours are really useful, such as when interacting with the Office object model as was clearly demonstrated by Scott Hanselman. I can understand why Microsoft deems this necessary. There’s no point in being a purist when it just makes life difficult ;-)

             

            In C#, a lot of the dynamic stuff is achieved internally by just using the type ‘object’. Anders Hejlsberg went into some of that in his PDC session “The Future of C#”. Towards the end of his session, he did a demo where he essentially wrapped up the whole C# compiler as a dynamic type, executed it on a thread with a message pump  and used it to dynamically compile segments of code that he threw at it from a command prompt, including dynamically creating Windows Forms from the command line. Fun to watch, at least the crowd seemed impressed.

             

            --Tim Long

             

            From: ASCOM-Talk@yahoogroups.com [mailto:ASCOM-Talk@yahoogroups.com] On Behalf Of Bob Denny
            Sent: 14 November 2008 00:47
            To: ASCOM-Talk@yahoogroups.com
            Subject: Re: [ASCOM] C# 4.0 interesting stuff

             

            More interesting info from Dare Obasanjo - C# is the Next Python: Duck Typing and C# 4.0. One of the things I love about Javascript is its "duck typing" - though I confess to having never heard of the term till I read Dare's article. It looks like late binding is becoming more appreciated in the .NET world. It's benefits were what drove the original "late binding only" decision I made back in 1999. Anyway, for those of you who are software authors this article might be interesting...

              -- Bob

          Your message has been successfully submitted and would be delivered to recipients shortly.