|
Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.ide digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript electronics |
digitalmars.D.learn - scope keyword in 'parameter' context
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.
Apr 21 2008
Spacen Jasset wrote: Apr 21 2008
Robert Fraser wrote:Spacen Jasset wrote: Apr 22 2008
|