--snip--
Bosak:class Resource { //can be any resource from files to streams to anythingResource[] used; void opDispose() { writeln("Resource disposed!");
You should avoid doing IO in a destructor/finaliser. Writing to STDOUT can fail which may lead to resource leaks (if it throws).
//in opDispose the resource should dispose all it's resources tooforeach(res; used) res.opDispose(); } static Resource open(string name){ return new Resource; } }
--snip--