Tech Off Post

Single Post Permalink

View Thread: Ideas for C# 5.0
  • User profile image

    exoteric said:
    ramooon said:

    Interesting idea. It looks like a more complete/holistic/uniform approach to type extension, kudos. It is reminiscent of partial classes, except not exclusive for classes. Now I wonder: if you have a partial class A and another partial class B in two distinct namespaces and say you have a simple console program and the console program imports partial class A; will partial class B then also implicitly be used or only if you explicitly import that namespace? In the latter case the partial class construct looks pretty darned close to what you want, except partial to classes, so to speak. Hindsight is great.


    As for public/private, private is probably a sign of imperativeness because in an imperative setting you want to be careful about who's modifying your object using your special helper methods whereas when constructing new objects it's not really that big of an issue and this default looks wrong for a mostly-declarative world (or functional if you will). This will also save lots of code having to explicitly declare public all over. Well... too late for C#, that ship sailed long ago.

    Well, I'm not sure to understand what you said but the extensions would be available only if you import the right namespaces (ie. exactly the same behavior as the current syntax). The main benefit over partial classes is that it does not require  the 'partial' keyword at the declaration site and it is not limited to classes therefore basically everything is extensible by default Smiley What I didn't realize is that the partial keyword would become totally useless o_O ... right ?


    BTW Here's what I would like to see in future C# releases:

    - Contracts: Spec# contracts built-in the language (with the bang non-null operator)

    - Metaprogramming: a way to have user-defined keywords and syntax (ie.  a 'keyword' keyword and so on)

    - Immutablilty and Purity keywords

    - Some more declarative and lazy stuffs -- I absolutely love LINQ


    Another idea, but IDE specific:

    I wonder why although the IDE is now WPF based, it is still limited to classic characters ?

    For example if I type something like "-->" I would like the IDE to replace it with a real arrow.

    This would allow custom symbols to be used in modern languages...