News for hackers. Stuff that matters.
Re:Building a bare-metal bootable game for Raspberry Pi in C# by kevingadd on Monday December 11, 2023 @03:05PM (#38604791)
The problem with doing memory model stuff as a compile time flag is it's all-or-nothing, it becomes very hard to transition a whole app to it or even dream of making something like the whole standard library support it.

Typically you'd see a model that allows file-by-file transitions so that you can slowly clean up a codebase to make it 'safe' for a given model. This is (afaik) roughly how non-nullable references were added to C#.

If you look at it from that perspective, I don't think you would end up wanting the compiler to help you with this. You'd introduce some sort of 'refcounted pointer' type, maybe called Rc<T>, which wraps a T* + a deallocator. I can't imagine C# ever letting you overload the -> operator though so the ergonomics would be bad.

Re:Building a bare-metal bootable game for Raspberry Pi in C# by nurettin on Monday December 11, 2023 @11:53PM (#38609690)
I think it needs to be both Smartpointer helpers and a compiler flag. Don't see how it can be done any other way.