Andrei Alexandrescu <seewebsiteforem...@erdani.org> wrote:
I'm thinking of an API that allows people to dynamically add "to do" stuff, a la C's atexit(). Yours above is dynamic (because client code can append to toFree) but is hand-written by the client.
So like this: import std.stdio; void delegate()[] terminators; void atExit( void delegate() dg ) { terminators ~= dg; } static ~this( ) { foreach ( t; terminators ) { t( ); } } void main( ) { atExit( {writeln("OH HAI! I BROKE UR THREAD");} ); } -- Simen