Resource Management... Howto?

Samuel Winchenbach swinchen at eece.maine.edu
Mon Jul 9 08:56:22 PDT 2007


Ok, I have come to a number of conclusions...

#1) Scope classes are cool, but in my situation their limitations are 
problematic (not being able to store them in an array for example)  So I 
need a method that doesn't rely on them.

#2) D can not really do not reference counting because lack of copy 
operator.   So maybe I should just ditch reference counting all together 
and try to make it slightly simpler.

auto h = resource.create();
resource.destroy(h);

something like that.  avoid reference counting and just rely on the 
developer using the resource manager to free the resource.

Opinions on this?


Also fonts have been bugging me.  Fonts can have the same file name, but 
different settings (italic, bold, underlined, pt. size, etc...)  so 
instead of having: FontList[char[]] I think I might have 
FontList[FontDescriptor[]].   This seems reasonable right?

So I think my resource manager will have both an AA and a descriptor for 
each type of resource.   Still working on how to make it somewhat 
generic.   I would really like there to only be one type of handle, one 
type of createResource and one type of freeResource.  I am not sure this 
is feasible though.   At this point I am just blabbing...

Thanks for the input,
Sam


More information about the Digitalmars-d-learn mailing list