Re: Can someone explain how mixin is implemented?

2011-05-19 Thread Matthew Ong
On 5/19/2011 1:23 AM, Jesse Phillips wrote: Matthew Ong Wrote: Perhaps I am missing something here. How can class level definition be part of the mixin? Does mixin generate the same binary code as #define as inline code,which meant that same binary is repeated everywhere that macro is used?

Re: Can someone explain how mixin is implemented?

2011-05-19 Thread Matthew Ong
On 5/19/2011 9:18 PM, Matthew Ong wrote: On 5/19/2011 1:23 AM, Jesse Phillips wrote: Matthew Ong Wrote: Perhaps I am missing something here. How can class level definition be part of the mixin? Does mixin generate the same binary code as #define as inline code,which meant that same binary is

Re: Can someone explain how mixin is implemented?

2011-05-19 Thread Steven Schveighoffer
On Thu, 19 May 2011 09:43:14 -0400, Matthew Ong on...@yahoo.com wrote: On 5/19/2011 2:32 AM, Jacob Carlborg wrote: Template mixins are not exactly like copy and paste code. * You can mixin the same template, at the same location, twice, taking different parameters * Mixed in methods doesn't

Re: Can someone explain how mixin is implemented?

2011-05-19 Thread Matthew Ong
On 5/19/2011 10:02 PM, Steven Schveighoffer wrote: On Thu, 19 May 2011 09:43:14 -0400, Matthew Ong on...@yahoo.com wrote: According to Jonathan, In the case of template mixins, you're essentially copying and pasting code. Yes. Liked what you said, with optimization at compiled time. I am

Can someone explain how mixin is implemented?

2011-05-18 Thread Matthew Ong
Hi, From what I can see mixin in D is used in place of #define in C++(cool!!!). However, I do have a few question. mixin with template does address some of this issue I supposed. That does allow me to define up to level of content of a class but is not class itself. mixin template

Re: Can someone explain how mixin is implemented?

2011-05-18 Thread Matthew Ong
On 5/18/2011 10:46 PM, Steven Schveighoffer wrote: but you can do a string mixin to define the entire class. This is not an easy thing to do, because you'd have to write the entire class as a string of text. Thanks for the attempt and sample code. Seen that script import somewhere before.

Re: Can someone explain how mixin is implemented?

2011-05-18 Thread Jacob Carlborg
On 2011-05-18 20:05, Jonathan M Davis wrote: On 5/18/2011 10:46 PM, Steven Schveighoffer wrote: but you can do a string mixin to define the entire class. This is not an easy thing to do, because you'd have to write the entire class as a string of text. Thanks for the attempt and sample code.

Re: Can someone explain how mixin is implemented?

2011-05-18 Thread Jesse Phillips
Matthew Ong Wrote: Perhaps I am missing something here. How can class level definition be part of the mixin? Does mixin generate the same binary code as #define as inline code,which meant that same binary is repeated everywhere that macro is used? Or does it make a linked to the in a

Re: Can someone explain how mixin is implemented?

2011-05-18 Thread Jonathan M Davis
On 5/18/2011 10:46 PM, Steven Schveighoffer wrote: but you can do a string mixin to define the entire class. This is not an easy thing to do, because you'd have to write the entire class as a string of text. Thanks for the attempt and sample code. Seen that script import somewhere