Hacker News new | ask | show | jobs
by to11mtm 10 days ago
TBH, at least in my head, I feel like what it needs more is a 'string-ish type that can be used in a pool'.

With Pooling/Arenas already semi-established, you can do lots of stuff with pools/arenas. Where the challenge comes, is how much of Corelib (and normal apps) use strings in places, and you can't get around that without a lot of DIY. The "foostring" u8 const conversion helps for some cases but doesn't cover nearly enough cases.

1 comments

What about Span<char> over char[]? Or a tiny struct wrapper with the length. Or do you mean some deeper runtime support?
Ehh, it's hard to pin down fully, at least at this moment;

The Runtime Support thing is definitely part of it; things have improved over time but there is still a gap as far as stuff needing a string where a poolable thing could be better; ADO.NET comes to mind, especially when we consider how big some queries can get with ORMs and what a reasonably complex (or outright jank) data model can require. There's others, but that is the major case (And TBH It shouldn't be that hard to solve from an API standpoint, right? just have a default virtual impl that does the String conversion on the normal methods...)

But also, the elephant in the room to where we can do 'u8' on a literal that becomes a ReadOnlySpan/ReadOnlyMemory of bytes. It's a smell for the lack of a proper UTF8 string holder in general.