4 ms·
F# allows you to break up the tuple immediately, this tremendously aids readability as it avoids introducing confusing names. let (a, b) = Foo() Compared
by Guvante 12y ago
F# allows you to break up the tuple immediately, this tremendously aids readability as it avoids introducing confusing names.
let (a, b) = Foo()
Compared to
var tuple = Foo();
var a = tuple.Item1;
var b = tuple.Item2;
You could consider them equivalent, but conceptually it is faster to understand that a is the first result IMO.
- MichaelGG 12y agoI'm just pointing out that System.Tuple doesn't suck as the commenter was saying. It's just C#'s handling of them.
- mattmanser 12y agoWhich means they suck in C# doesn't it?
- Guvante 12y agoGiven that the proposal specifically mentions using struct instead of class it isn't just C#'s handling that makes it difficult to leverage System.Tuple.
- MichaelGG 12y agoFunny, the BCL folks went with a class and we were assured it was a good decision. Maybe they just need to get their JIT up to date and do escape analysis so this kinda thing doesn't cost so much. (Easy for me to say they should do it...) After using Rust+LLVM I'm accustomed to the idea of not having to pay so much for features.