FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

mixin(Sync!("this"));

 
Post new topic   Reply to topic     Forum Index -> Yage
View previous topic :: View next topic  
Author Message
dimitrijejankov



Joined: 04 Oct 2011
Posts: 5

PostPosted: Wed Oct 05, 2011 3:22 pm    Post subject: mixin(Sync!("this")); Reply with quote

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 Smile
Back to top
View user's profile Send private message
JoeCoder



Joined: 29 Oct 2005
Posts: 294

PostPosted: Thu Oct 06, 2011 7:24 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Yage All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group