View previous topic :: View next topic |
Author |
Message |
dimitrijejankov
Joined: 04 Oct 2011 Posts: 5
|
Posted: Wed Oct 05, 2011 3:22 pm Post subject: mixin(Sync!("this")); |
|
|
Hi, well now I'm studing your engine, and one line of code just gives me the creep.. mixin(Sync!("this")); As I see you are passing a reference to the scene object to that Sync method but I have no clue what it does... could you please explain it to me |
|
Back to top |
|
|
JoeCoder
Joined: 29 Oct 2005 Posts: 294
|
Posted: Thu Oct 06, 2011 7:24 pm Post subject: |
|
|
This is using a feature in D called a mixin. It allows you to build code at compile time by concatenating strings, among other things.
More information here: http://www.digitalmars.com/d/1.0/mixin.html
In that particular instance, it is pulling in the code from the bottom of scene.d. This is equivalent of wrapping the body of the function with synchronzed(this) {}. I didn't use D's synchronized statement at the time because tango's benchmarked faster. |
|
Back to top |
|
|
|