Linked by Thom Holwerda on Sun 12th Jul 2009 21:29 UTC
Thread beginning with comment 373105
To view parent comment, click here.
To read all comments associated with this story, please click here.
To view parent comment, click here.
To read all comments associated with this story, please click here.
As to your other complaints... welcome to functional programming.
His other complaints had nothing to do with FP.
Seriously... you want to add a static method to an instance variable? do you plan to allow the dynamic creation of a new class?
No, he wanted to add a static method to an existing class without subclassing or recompilation. Currently C# allows you to only add non-static methods to existing classes. Which seems like a pretty artificial limitation.
non-deterministic resource deallocation? Welcome to garbage collection.
Garbage collection has nothing to do with it. If an object (like a file or a GDI brush) has some resources associated with it, I want them to be deallocated immediately when the object goes out of scope, and not a few minutes later when the object is garbage collected.
There is the IDisposable interface and the using(...)-Pattern, but there is no way to enforce this. That is why C++ (even managed C++) has destructors that get called immediately. RAII is tremendously useful, but impossible to do safely in C#.
As to your other complaints... welcome to functional programming.
What does that have to do with functional programming? C# is not a functional language. It is just a language that took a few features (closures) from functional programming without understanding the big picture. For example, the biggest property of functional languages is referential transparency. But it is very difficult to ensure immutability in C#. In fact most language patterns (property and array initializer syntax) encourage mutable objects.
Scala has none of the deficiencies I mentioned and is much more functional than C#.
Seriously... you want to add a static method to an instance variable? do you plan to allow the dynamic creation of a new class?
I want to be able to add a static method to a type. To be precise, I do not want any static methods in the first place. I would prefer the scala approach.
But if you have a language feature like static methods or interfaces you should make sure that other language features (operators, extension methods) work together with that feature. Otherwise the language is nonorthogonal, which is just bad design.







Member since:
2006-03-01
Superficially C# is very similar to C++. But many of the things you take for granted in C++ are impossible in C#.
For example there is no mechanism for deterministic deallocation of resources.
There is not a single feature in C# that applies to all other parts of the language. For example, you can not use operators when using interfaces. You can have instance extension methods, but not static extension methods. You can not do any calculations on generic type parameters. The list goes on and on.
C# started as a decent java-inspired language that did some things better than java. But nowadays it is just a horrible pile of nonorthogonal language features.
I will take java any day over C#. A simple language with complete and comprehensive library support is preferable to a kitchen sink language like C# where every new technology fad results in an extension of the language.
If you want a modern JVM based language, take a look at scala.
Edited 2009-07-13 13:52 UTC