13 points · by johns · 17y ago · 17 comments
My argument for why this is good seems pretty simple:
1) The code that does this isn't that hard to understand
2) All code that uses it becomes much more readable
3) The total of all code in #2 is going to be modified more often by several orders of magnitude than the code in #1
However, it also appears that most people on that discussion would disagree with my point #2 (code using this becomes more readable). That's probably where the interesting things come in to play.
For me, I don't care about abuse of syntax, etc. as long as code does what a casual observer would guess it does. Perhaps I'm spoiled by working somewhere where people actually write readable code, and if I worked somewhere else, I would want to forbid any syntax magic whatsoever, but more likely I would just be updating my resume :)
Generally, I don't think these kind of improvements are appreciated in C# as they are polymorphic and make it much harder for the compiler.
The optional arguments feature is to define a function like def fun(..., **kw)http://stackoverflow.com/questions/1718037/abuse-of-c-lambda...
Or, as Steve Summit put it to me when I told him about this, "The audience leaps to its feet and shouts 'NO!'"
"=>" is the C# lambda operator, which makes an anonymous function. Args go on the left of it, the return value on the right. In most cases, the names given to args don't matter.
The thing is, c# coders cannot build their own LINQ-style DSLs in c#. Rubyists do build thier own DSLs in Ruby.