scope keyword in 'parameter' context
Spacen Jasset
spacen at yahoo.co.uk
Mon Apr 21 15:22:06 PDT 2008
I have this construct, but would like the new Image to be collected
after it is used in the Texture constructor.
texture = new Texture(new Image("data/models/cp2/a1.jpg"));
I cannot say this, but would like to:
texture = new Texture(scope new Image("data/models/cp2/a1.jpg"));
Is there any workaround, other than:
scope Image image = new Image("data/models/cp2/a1.jpg");
texture = new Texture(image);
Presumably I could write some sort of mixin, which I haven't yet used at
all in D.
This may seem trivial, but it can be a pain where I want to do the same
thing over, and know that I don't want to keep the Image object, and
infact in some cases I *must* make sure it is collected before the end
of main, as the library calls it uses become unavailable, as the library
is unloaded at the end of main scope.
More information about the Digitalmars-d-learn
mailing list