top | item 45898738

(no title)

kfuse | 3 months ago

Updated a pet project of mine and got a minor break:

  var pixels = new uint[renderers.width * renderers.height];
  var pixels2 = MemoryMarshal.Cast<uint, ulong>(pixels);
  pixels2[idx] = ...
In NET9.0 pixels2 were Span<ulong>, but in NET10.0 a different MemoryMarshal.Cast overload is used and it is ReadOnlySpan<ulong> now, so the assignment fails.

Spans is such a fundamental tool for low level programming. It is really unfortunate they were added relatively late to the language. Now every new version includes a slew of improvements related to them but they will never be as good as if they were there from the start or at least as early as generics were.

discuss

order