Phobos v3 idea: File interface

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Thu Sep 19 21:43:42 UTC 2024


On 20/09/2024 9:18 AM, Paul Backus wrote:
> On Thursday, 19 September 2024 at 20:39:33 UTC, solidstate1991 wrote:
>> In a nutshell:
>>
>> Create either a base class or an interface, which defines basic file 
>> accessing capabilities, then let that be used for not just files on 
>> the disk, but for things like the network, memory mapped files (would 
>> be great for compressed files without writing them to the disk first, 
>> etc.).
> 
> In Phobos v2, `File` is a wrapper around a C `FILE*`, which means that 
> its feature are limited by what the C library supports.

Worth noting is that ``File`` is a reference counted struct.

Unfortunately this is where we enter hill to die on territory for me.

System handles must be deterministically cleaned up. If you do not do 
this, you can run out of handles and then crash.

This is very easy especially for the 100k req/s target, think 10 
seconds, not 2 minutes to run out of handles.

I am very willing to say, that RC types cannot go into GC memory (the 
memory itself can be GC, but the cleanup must be done via RC).

Right now RC is blocked by Walter on owner escape analysis. This is why 
I'm pushing so hard on this design wise currently.

I did ask Steven a couple months ago, and a new GC design will not lift 
this restriction. This is a hard requirement.



More information about the Digitalmars-d mailing list