Re: How to wrap SDL?

2011-01-24 Thread Stanislav Blinov
22.01.2011 23:04, Sean Eskapp пишет: I'm using the Derelict SDL bindings, and I'm wrapping some parts of SDL in my own objects. Originally, I was using classes, but this caused a number of errors when the program exited, since Derelict unloaded itself before the garbage collector took care of des

Re: How to wrap SDL?

2011-01-23 Thread Dan Olson
Sean Eskapp writes: > == Quote from Andrej Mitrovic (andrej.mitrov...@gmail.com)'s article >> You can use scoped!() from std.typecons: snip >> You must not escape a reference to the object outside of the foo() >> scope. Note that you will get a runtime error if you try to do >> something like t

Re: How to wrap SDL?

2011-01-22 Thread Christopher Nicholson-Sauls
On 01/22/11 14:53, Sean Eskapp wrote: > == Quote from Andrej Mitrovic (andrej.mitrov...@gmail.com)'s article >> You can use scoped!() from std.typecons: >> import std.stdio; >> import std.typecons; >> class A >> { >> ~this() >> { >> writeln("A destructor"); >> } >> } >> void foo

Re: How to wrap SDL?

2011-01-22 Thread Sean Eskapp
== Quote from Andrej Mitrovic (andrej.mitrov...@gmail.com)'s article > You can use scoped!() from std.typecons: > import std.stdio; > import std.typecons; > class A > { > ~this() > { > writeln("A destructor"); > } > } > void foo() > { > auto a1 = scoped!A(); > } > void main(

Re: How to wrap SDL?

2011-01-22 Thread Andrej Mitrovic
You can use scoped!() from std.typecons: import std.stdio; import std.typecons; class A { ~this() { writeln("A destructor"); } } void foo() { auto a1 = scoped!A(); } void main() { foo(); writeln("exiting.."); } You must not escape a reference to the object outs

How to wrap SDL?

2011-01-22 Thread Sean Eskapp
I'm using the Derelict SDL bindings, and I'm wrapping some parts of SDL in my own objects. Originally, I was using classes, but this caused a number of errors when the program exited, since Derelict unloaded itself before the garbage collector took care of destructing my classes. So I switched to