Tech Off Post

Single Post Permalink

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

    stevo_ said:
    TechChaser said:

    I think this thread is specifically about language features, in terms of .net features, I'd love to see some work put into making compilation more extensible (like postsharp for example)..

    Yeah, it would be interesting to see an application go through some programatic transform before compilation.  Something a bit more powerful than the simple #if(DEBUG) ugliness.  Maybe along the lines of a Linq to Parse Tree, or Linq to Assembly, or Linq to Attributes.  ie, you could have your precompiler set up with a set of Linq expressions, and if you wanted to do a core compile, you would choose the one that removed all the [UI]-decorated classes and methods.


    That would also allow a lot more flexibility for encapsulation and information hiding than the current five access specifiers, and would enable things like friend classes without explicitly adding friend classes.  ie, the Linq code could specify that classes decorated with [Tester] would have access to all methods decorated [Testable], but that no other classes would be able to see it.  That would allow the "architects" to create the attributes and write the Linq code to determine what is visible to what, while the application programmers simply create classes to work within those boundaries.


    Something like a formal, compilable version of a standards document.


    Another nice thing about doing things this way is that you gain the power of doing macro-type stuff, but since everything is just a Linq-to-Parse-Tree, it would be analyzable realtime to the editor and intellisense (just like the #if(DEBUG) is now).