Tutorial :Universal Comment Identifier for .NET



Question:

What is the most prohibitive aspect of having a universal comment identifier for all .net languages?

For example, in each language the symbol "??" would identify a comment. (I'm not saying that it should be "??"... just an example.)


Solution:1

Backwards compatibility is probably the biggest problem with changing the comment token.


Solution:2

In C#, the '??' operator denotes null coalescence. Repurposing this for comments would render a large amount of code non-operational.

I know you said it's just an example, but this is the problem you're facing - finding a single token that isn't used in any .NET language. I don't think it's a practical goal.

One of the goals of .NET was to allow multiple languages to target the runtime environment, while allowing those languages to retain their own distinction. Your idea runs directly against the grain of this goal.


Solution:3

I don't really see a point to having a "universal comment identifier" any more than I see a point to unifying the way .NET languages implement looping constructs or class constructors. At some point, you'll be unifying-away the uniqueness of each language and we'll all by writing IL.


Solution:4

I'd be happy if the universal comment indicator was // ... But then that's because I'm used to c/c++/java/c#. :-) they're the majority anyway, right? ;-)


Solution:5

Something you might want to look at is Xml comments. Each language retains it's own comment identifier, but the schema used for the comments is the same across all languages and the compiler for that language knows how to strip them out into an xml file that works with intellisense.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »