C# vNext wishlist: comma less argument list

Mitch Denny has a post about his feature request for the next version of C#

he wants to have a shortcut to format strings, which would basically allow you to go from this
string s=string.Format(”{0}{1}{2}”, a, b, c);
to this:
string s=@(”{0}{1}{2}”|a|b|c);

I don't think I like the proposed alternative, all you are doing is replacing the "," with the "|" character and making the name shorter.
You could always write your own little wrapper:
//*** you could call it "f" if you wanted
static string fmt(string format, params object[] parameters) {
return string.Format(format, parameters);
}

and get
string s=fmt("{0}{1}{2}",a,b,c);

which is almost the same as the proposed solution

another problem is that this proposal solves a very particular problem which is string formatting and we can get pretty much the same by writing our own little wrapper

but anyway, it gave me an idea for my own feature request
comma-less arguments

string s=fmt("{0}{1}{2}" a b c);

The scope of this change is much wider and actually "desugars" the language

now this change will most likely not happen, since this is a C family language and would take a significant change to the parser but this is my own wish/feature request so there you have it
Published 09 January 08 11:56 by Que quieres desarrollar hoy?
Filed under:

Comments

No Comments
Anonymous comments are disabled