News for hackers. Stuff that matters.
Re:Poll: What's Your Favorite Programming Language? by jbrechtel on Friday March 23, 2012 @08:42PM (#3748037)
Why would sugared destructuring not make sense in C#? Or first class events and delegates?
Re:Poll: What's Your Favorite Programming Language? by hackinthebochs on Friday March 23, 2012 @09:35PM (#3748150)
Destructuring just doesn't fit with the current language syntax. There are no copy constructors in C#, so something like [a, [b, c]] = [1, [2, 3]] makes no sense syntactically. In languages where declaring objects don't require a new, this syntax follows naturally.

For the simple case of say, destructuring a tuple, that could work well: a, b = ReturnsATuple(). But anything more general would just seem tacked onto the language.

But then again, tuples don't really fit well in C# either! Tuples are only useful if you don't have to declare their types, ever. Without full type inference, nothing is saved by using tuples over, say, an inline object.

I don't understand the significance of first class events, so I can't really comment on that. And as far as I know, delegates are first class now with the inclusion of lambdas.