Re: How to overload == for System.Double

Jack Brown <[email protected]> Fri, 2 Feb 2007 09:36:23 -0800
Newsgroups gmane.comp.windows.devel.dotnet.cx
Message-ID <1367B16B94997E418CDDC01D1BDEF179F083A2@ei-postal.EI.Electroimpact.com>
Thanks, all, for the responses. It definitely answered my question in that, no, I can't extend ==. :)

I was a bit surprised at the general consensus that what I wanted to do was BAD. The below is a nice explanation for at least one reason.

Thanks again.

- Jack

-----Original Message-----
From: Discussion relating to the specifics of the C# and Managed C++
languages [mailto:[email protected]]On Behalf Of Peter
Ritchie
Sent: Friday, February 02, 2007 9:02 AM
To: [email protected]
Subject: Re: [DOTNET-CX] How to overload == for System.Double


C# has deep roots in C++ (C# is a form of C++++).  There was a conscious
effort in the design of C# in the beginning to break free of the non-OO
legacy attributes of C++ (as it has deep roots in C).  A very powerful
feature of C++ is nonmember functions that facilitate much of the
abilities that extension functions give you.  There was an explicit
decision to not include a feature like nonmember functions in C# because
it didn't fit within the vision of the C# language (at the time) and
wasn't considered safe, truly object oriented, etc.

Now, in the huge push to implement LINQ in C# 3 it was deemed that C#
wasn't flexible enough to implement what was needed.  They're--what I
consider--deviating from that initial vision of simplicity and breaking
their initial rules.  That's further reinforced in the C# spec with
telling comments like "...extension methods be used sparingly and only in
situations where instance methods are not feasible or possible."

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com