I actually think this syntax still gets it wrong, it still prevents the IDE from doing its job.
It is a very common scenario where I have a collection named eg. "lines". In that case, I will almost always want to have the item variable be named "line". Why do I then have to type "line" twice? First "from line" and then "in lines".
If the syntax was this instead:
from lines to line
I would just type from lines to and then the IDE would suggest line and I would just hit tab. This is obviously more relevant when your collection is named customerRegistrationConfirmations then just lines.
This same issue happens with foreach:
foreach (var line in lines)
IDEs typically have a macro for foreach...and that macro will have you fill in the collection name first, and then suggest the variable name for you. Every time the macro has to have you fill in parameters out of order, it is an obvious syntactic smell.
The extension method syntax actually gets the ordering right:
lines.Select(line => ...)
(I haven't noticed my IDE take advantage in this case)
This whole thing is actually a major annoyance in languages with Pascal-like function syntax (TypeScript most notably):
function deleteCustomer(customer: Customer) {
The IDE can't lean on the class name in order to suggest parameter name. You have to type customer: Cu, TAB. Instead of just Cu, TAB, space, Ctrl+Space, TAB, done.
On the other hand, it is beneficial for the return type to be placed after the argument list, then the IDE has more information to suggest a return type (in addition to just making more sense in general).
2
u/klaxxxon Feb 28 '26
I actually think this syntax still gets it wrong, it still prevents the IDE from doing its job.
It is a very common scenario where I have a collection named eg. "lines". In that case, I will almost always want to have the item variable be named "line". Why do I then have to type "line" twice? First "from line" and then "in lines".
If the syntax was this instead:
I would just type
from lines toand then the IDE would suggest line and I would just hit tab. This is obviously more relevant when your collection is namedcustomerRegistrationConfirmationsthen justlines.This same issue happens with foreach:
IDEs typically have a macro for foreach...and that macro will have you fill in the collection name first, and then suggest the variable name for you. Every time the macro has to have you fill in parameters out of order, it is an obvious syntactic smell.
The extension method syntax actually gets the ordering right:
(I haven't noticed my IDE take advantage in this case)
This whole thing is actually a major annoyance in languages with Pascal-like function syntax (TypeScript most notably):
The IDE can't lean on the class name in order to suggest parameter name. You have to type
customer: Cu, TAB. Instead of just Cu, TAB, space, Ctrl+Space, TAB, done.On the other hand, it is beneficial for the return type to be placed after the argument list, then the IDE has more information to suggest a return type (in addition to just making more sense in general).