Linked by Thom Holwerda on Sun 12th Jul 2009 21:29 UTC
OSNews, Generic OSes Even though news has been slow the entire week due to the fact that it's summer and people are more interested in vacation than in technology news, we still had a lot of interesting stuff this week. Google obviously captured the headlines with its Chrome OS, but we also talked about Mono, Richard Stallman, and many other things.
Permalink for comment 373131
To read all comments associated with this story, please click here.
RE[8]: Mono
by tuttle on Mon 13th Jul 2009 19:53 UTC in reply to "RE[7]: Mono"
tuttle
Member since:
2006-03-01

Garbage collection has everything to do with it. The garbage collection system takes over responsibility for resource deallocation.


Garbage collection takes over responsibility for memory deallocation. For more valuable resources such as windows handles and file handles, you need a more precise mechanism. C++ provides such a mechanism. And so does C++/CLI. But C# does not (there is no way to enforce that somebody calls Dispose() on your object implementing IDisposable).

you use a language with GC, you accept that. Managed C++ has GC features but that is more a function of being compiled to IL code rather than it being a central feature of the language.


Managed C++ has both. You can have garbage collected object (allocated with gcnew) that gets garbage collected, but you can also use RAII since you can have deterministic destructors that get called when the object goes out of scope.

C# is an evolving mixed paradigm language. it is both imperative and adding Functional features to support interesting things in the framework.


You can't really call it functional because it has very little support for immutable data structures. Immutability is a prerequisite for referential transparency, and referential transparency is the core property of functional languages.

As to what you want to do with Static methods, you want it to work in a way you like rather than a way it is meant to work. You want to add static features? you will have to subclass it. It certainly should never be able to be done at run time.


I don't want to do anything at runtime. I would just like to add static methods to existing types, since static methods are (unfortunately) very common in C#.

If you write the type name and a dot, you get the list of all public static methods of this type and its base types. I would like to add a method to this list.

An example would be adding a Parse<T>(string) method to System.Enum.

Whether adding methods to existing types/instances is a good idea is another topic. But if one is possible, then the other should be possible as well.

By the way: enums are another topic where C# is broken. Why is it not possible to use enums as type parameters? And why do enums not implement the IEquatable<T> interface?

I think static methods and fields are a stupid idea in the first place. That is why they don't exist in well-designed languages like scala.

Reply Parent Bookmark Score: 3