2 ms·
I like this idea in theory. the rectangle the example is a good one that I've personally tripped over before. That being said, this could hurt readability in s
by etimberg 12y ago
I like this idea in theory. the rectangle the example is a good one that I've personally tripped over before.
That being said, this could hurt readability in some cases as single lines of code are going to get larger, especially with length parameter names. Another issue I forsee is a code style where parameters are prefixed with p_. Having to type that prefix each time would be annoying, but finding a readable syntax that allows a separately specified name will also be confusing.
- rootbear 12y agoI agree this probably looks better in theory than it does in practice. As far as long function declarations go, it sure would be nice to go back to declaring multiple arguments of the same type without repeating the type: int myfunc(float x, y, z, r, g, b, a); instead of int myfunc(float x, float y, float z, float r, float g, float b, float a); Yes, I know about structs, but often that's not applicable. And if the type name is some long thing, then you have to really look carefully to notice they are all the same type. It seems this style is now being seen as a feature, although I don't know of any language that required repeating the type for each parameter until C and C++ adopted this for the new style function prototype declarations. I was very sorry to see that D has also adopted this "feature". I believe go allows multiple declarations of the same type. I'd much rather see this fixed in C and C++ than have them clutter up things with named parameters.
- restalis 12y ago"int myfunc(float x, y, z, r, g, b, a);" This got me thinking of the old C ways: http://msdn.microsoft.com/en-us/library/efx873ys.aspx http://msdn.microsoft.com/en-us/library/efx873ys.aspx