Re:Why F#?
by kkukshtel on Tuesday April 01, 2025 @10:44AM
(#43547391)
Modern C# collection expressions make the definition of names closer to F#:
I know working on "natural type" of collections is something the C# team is working on, so it feels possible in the future that you'll be able to do this:
Which I think would then allow:
[ Parent
| on HN ]
I did try that initially and got
<source>(5,1): error CS9176: There is no target type for the collection expression.
.. which I took to mean that, because .Select is an extension method on IEnumerable, the engine was unable to infer whether the collection should be a list, array, or some other type of collection.It seems reasonable to have it default to Array if it's ambiguous, maybe there's a downside I'm not aware of.
Re:Why F#?
by DeathArrow on Wednesday April 02, 2025 @08:03AM
(#43555767)
Maybe you can submit a proposal/issue to the C# language team? I'd vote for it!