> This has been hashed over many, many times. While it once had significant
performance benefits in VB, most find that it doesn't offer anything but
minor cosmetic changes(and not improvement in everyones mind), that it is
easy to abuse, somewhat difficult to fit into the language and maintain
consistency, and that its potential for abuse outweighs its very limited
value.
Sure, But operator overloading is there, and it can be abused.
I can write an abstract class, subclass it into two clasess, having one of
their mothods staying virtual, while reintroducing another one. In a couple
of subclasses to the reintroduced one, I could just make one of these
methods virtual again. And start subclassing all again yet again... Wanna
maintain it for me? Is that abuse?
Also I could code a property like this
public int Count
{
get
{
MyCode.FormatC( );
return 0;
}
}
Isn't that abuse?
No! It is poor communication skills!
If I found it, I'd make the property Count into a method and rename it to
FormatC();
And about sugar, the same could be said for the 'using' keyword. Why not
just use try finally and call dispose?
Heck, who needs properties, why not just use get and set methods.... We
don't need no stinking delegates and events and are happy with the
Listener-pattern. Period!.. Adhere to the gang of four by default or we have
to get you assimilated. Resistance is futile! =)
Oh, why do we bother with all this sugar? We can do Vtables in assembler if
we wanted. Why not just push, mov and pop?
While 'with' was clumsy in Delphi (poor intellisense) and retarded in VB (no
scope) it could be highly useful in .NET. And it's more than just sugar...
MyClass o = new MyClass()
with(o)
{
o. //<- only members of MyClass shows in intellicense in visual studio.
int someNumber = o.x + o.y; //someNumber in a local scope.
o.z = someNumber;
}
someNumber = 0; // compile-time error. No such thing in scope.
I would like to see the above in C#. Makes for better maintainance.
If you don't want to use it, then don't. But I kinda like how C# gets
bloated... While not going C++
Cite:
Whenever the C++ language designers had two competing ideas as to how they
should solve some problem, they said, "OK, we'll do them both". So the
language is too baroque for my taste. (Donald E Knuth)
I agree with Knuth fully in this (like he would care what I think). But I
also think that a 'with'-statement and a more flexible switch could do
wonders for C#, and stying a clean language, without going 'baroque'...
My 2^2^2 cents....
Happy Coding
- Michael S
ps.
I like qutoes, and here comes some more on C++...
If you think C++ is not overly complicated, just what is a protected
abstract virtual base pure virtual private destructor and when was the last
time you needed one? (Tom Cargill)
I invented the term Object-Oriented, and I can tell you I did not have C++
in mind. (Alan Kay)
If C++ has taught me one thing, it's this: Just because the system is
consistent doesn't mean it's not the work of Satan. (Andrew Plotkin)
Within C++, there is a much smaller and cleaner language struggling to get
out. (Bjarne Stroustrup)
All C programs do the same thing: look at a character and do nothing with
it. (Peter Weinberger)
To me C++ seems to be a language that has sacrificed orthogonality and
elegance for random expediency. (Meilir Page-Jones)
Unix and C are the ultimate computer viruses. (Richard P Gabriel)
C++ is like jamming a helicopter inside a Miata and expecting some sort of
improvement. (Drew Olbrich)
C++: Simula in wolf's clothing. (Bjarne Stroustrup)