Challenge: write a reference counted slice that works as much as possible like a built-in slice

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Thu Nov 11 10:06:44 UTC 2021


On Thursday, 11 November 2021 at 09:15:54 UTC, Atila Neves wrote:
> I have not yet encountered cases where it would be necessary 
> that aren't "I'm implementing the standard library".

Not so sure about that. Arena allocators would be done with 
malloc, but you probably should wrap it with RAII.

Allocating directly from the OS (bypassing malloc) can in some 
cases be advantageous. But again, you are usually better off 
creating a RAII wrapper for it.

You also have dynamic stack allocation which can boost 
performance significantly. Sadly, Walter is against having this 
as a feature.


> I definitely don't miss having to make things fit into 48k of 
> RAM. I wrote code for a microcontroller once with 1k with 
> addressable bits. Good times. Sorta.

That's a lot! As a teen I did a project on Motorola 6800. I think 
it was launched with a whopping 128 bytes of static RAM, so you 
had to make almost everything ```immutable``` (EPROM) and avoid 
deep call-trees.




More information about the Digitalmars-d mailing list