fsharp / fslang-design

RFCs and docs related to the F# language design process, see https://github.com/fsharp/fslang-suggestions to submit ideas
517 stars 144 forks source link

[FS-1138] Avoid boxing on equality and comparison #747

Open Happypig375 opened 1 year ago

Happypig375 commented 1 year ago

Click “Files changed” → “⋯” → “View file” for the rendered RFC.

abelbraaksma commented 4 months ago

@Happypig375 I am wondering if the new PR https://github.com/dotnet/fsharp/pull/16857, which was just merged, removes the requirement for this RFC and/or replaces it.

I'll make a note in that particular PR as well. Perhaps we can update this RFC to address the changes over there done by @psfinaki?

psfinaki commented 4 months ago

So this suggestion, starting with its title in the RFC doc, mixes a few things together: NaNs and unnecessary boxing, and also this unnecessary boxing is currently happening in many places. Generally, the situation is quite nicely overviewed here now.

The NaN problem is still there and should be addressed. I guess we can either rewrite this RFC or close this one + a new one. Just saying that the more focused the suggestions are, the easier they are to reason about. I know I sound like Captain Obvious but IMO that's exactly the reason why all these problems have been take so long here.

abelbraaksma commented 4 months ago

No, I totally agree. And by focusing the NaN problem to mimic the C# track, we would have a more tailored and succinct discussion.

Ideally, I would just compare all blittable types as binary blobs and have the fastest speed up possible for equality, but unfortunately, that's not going to work for many reasons (some of which are shown in that white paper on equality optimizations).