RFC: reference counted Throwable

Dicebot via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 20 08:12:44 PDT 2014


On Saturday, 20 September 2014 at 15:05:38 UTC, Adam D. Ruppe 
wrote:
> On Saturday, 20 September 2014 at 14:33:21 UTC, Dicebot wrote:
>> Pretty much any time you do fibers + async I/O : to emulate 
>> blocking API one needs to catch and store exceptions from I/O 
>> routines so that later those can be re-thrown from resumed 
>> fiber context.
>
> Ah, indeed, and that could have a great many of them alive at 
> once. Blargh, it'd need a real allocator to handle freeing them 
> out of order.
>
> Nevertheless though, I still think the lifetime management 
> there is simple enough for the user-programmer that freeing it 
> manually isn't a big hassle and not worth making major changes 
> to the language over.

I don't follow. Lifetime is totally unknown there and completely 
up to actual application logic - from the point of view of the 
caller of something like `readFile()` it just a normal allocated 
exception that doesn't need any explicit management. Requiring 
any kind of manual handling would be a huge breaking change.


More information about the Digitalmars-d mailing list