News for hackers. Stuff that matters.
Re:Why F#? by bob1029 on Tuesday April 01, 2025 @01:57PM (#43549695)
> There’s no reason to do ToList there

In this case, I would move it to the very end if we are concerned about the underlying data shifting when the collection is actually enumerated.

Forgetting to materialize LINQ results can cause a lot of trouble, oftentimes in ways that happily evade detection while a debugger is attached.

Re:Why F#? by klysm on Tuesday April 01, 2025 @02:37PM (#43550065)
> if we are concerned about the underlying data shifting when the collection is actually enumerated

I’m not sure what you mean by this. You can fulfill the IEnumerable contract without allowing multiple enumerations, but that doesn’t really have to do with the data shifting around. Doing ToList can be an expensive and unnecessary allocation

Re:Why F#? by bob1029 on Tuesday April 01, 2025 @03:43PM (#43550636)
Imagine a live SQL query you are subsequently filtering with LINQ.
Re:Why F#? by klysm on Thursday April 03, 2025 @12:14PM (#43571873)
Then the ToList will force it to be evaluated on the client - not sure that situation applies