Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Proposal: Expose a zero allocation API to Godot C# bindings (github.com/godotengine)
5 points by tehnub on Sept 24, 2023 | hide | past | favorite | 1 comment


There may be some confusion about Span<T> still. Everyone talking about "span" from the C# side is of course talking about Span<T>, which is just a way to represent a contiguous memory segment that doesn't need to be managed. It's not 100% clear to me what reduz means that Spans can't happen, but then Span interfaces can happen. I wonder if there is some conflation with C++ span and C# Span<T>: C# does not need GDExtension to expose spans on its end for C# use Span<T>.

The definition of PackedVector2Array is:

  typedef Vector<Vector2> PackedVector2Array;
So, it's just a Vector? Internally there is PackedArrayRef<T> which wraps Vector<T> and adds a ref count to the struct.

Right, so in C# as an implementation detail on its end Span<T> can be used to operate over the Vector<T>. These are all just details though, I think everyone will end up with what they want more or less.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: