Re: Defining some stuff for each class in turn

2009-10-02 Thread Steven Schveighoffer
On Thu, 01 Oct 2009 13:53:46 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: Jarrett Billingsley wrote: On Thu, Oct 1, 2009 at 12:25 PM, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: [code injection] What do you think? I think it sounds interesting enough, but

Re: Defining some stuff for each class in turn

2009-10-02 Thread Christopher Wright
Andrei Alexandrescu wrote: Christopher Wright wrote: Andrei Alexandrescu wrote: I am becoming increasingly aware that we need to provide some means to define certain members (data and functions) for each class as if they were pasted there. Most of the examples given would be well served by

Defining some stuff for each class in turn

2009-10-01 Thread Andrei Alexandrescu
I am becoming increasingly aware that we need to provide some means to define certain members (data and functions) for each class as if they were pasted there. Right now that right is reserved to the compiler, which generates e.g. one static classinfo object for each class. But users would

Re: Defining some stuff for each class in turn

2009-10-01 Thread Jarrett Billingsley
On Thu, Oct 1, 2009 at 12:25 PM, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: I am becoming increasingly aware that we need to provide some means to define certain members (data and functions) for each class as if they were pasted there. Right now that right is reserved to the

Re: Defining some stuff for each class in turn

2009-10-01 Thread Andrei Alexandrescu
Jarrett Billingsley wrote: On Thu, Oct 1, 2009 at 12:25 PM, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: [code injection] What do you think? I think it sounds interesting enough, but I can't help but wonder if this is a feature that you've really thought through (especially wrt.

Re: Defining some stuff for each class in turn

2009-10-01 Thread grauzone
Andrei Alexandrescu wrote: Jarrett Billingsley wrote: I think it sounds interesting enough, but I can't help but wonder if this is a feature that you've really thought through (especially wrt. how it interacts with mechanisms such as template mixins and normal symbol inheritance), or if you

Re: Defining some stuff for each class in turn

2009-10-01 Thread Leandro Lucarella
Andrei Alexandrescu, el 1 de octubre a las 11:25 me escribiste: What do you think? I think this is close to Python metaclasses[1], but much more specific. It's amazing how many cool things one can do with Python metaclasses (there are several articles discussing them[2]) and decorators. I

Re: Defining some stuff for each class in turn

2009-10-01 Thread Denis Koroskin
On Thu, 01 Oct 2009 20:25:03 +0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: I am becoming increasingly aware that we need to provide some means to define certain members (data and functions) for each class as if they were pasted there. Right now that right is reserved to

Re: Defining some stuff for each class in turn

2009-10-01 Thread Andrei Alexandrescu
Denis Koroskin wrote: On Thu, 01 Oct 2009 20:25:03 +0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: [...] What do you think? Andrei This is cool. I'd also add Serialization task to the application list (currently I manually insert mixin Serializable!(); into every class.

Re: Defining some stuff for each class in turn

2009-10-01 Thread Phil Deets
On Thu, 01 Oct 2009 12:53:46 -0500, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: interface Comparator(T) { int opCmp(Comparator!T rhs); mixin(Impl) // for each implementation Impl { int opCmp(Impl rhs); override int opCmp(Comparator!T rhs)

Re: Defining some stuff for each class in turn

2009-10-01 Thread Andrei Alexandrescu
Phil Deets wrote: On Thu, 01 Oct 2009 12:53:46 -0500, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: interface Comparator(T) { int opCmp(Comparator!T rhs); mixin(Impl) // for each implementation Impl { int opCmp(Impl rhs); override int

Re: Defining some stuff for each class in turn

2009-10-01 Thread Christopher Wright
Andrei Alexandrescu wrote: I am becoming increasingly aware that we need to provide some means to define certain members (data and functions) for each class as if they were pasted there. Most of the examples given would be well served by decent builtin reflection. Walter thinks reflection is

Re: Defining some stuff for each class in turn

2009-10-01 Thread Andrei Alexandrescu
Christopher Wright wrote: Andrei Alexandrescu wrote: I am becoming increasingly aware that we need to provide some means to define certain members (data and functions) for each class as if they were pasted there. Most of the examples given would be well served by decent builtin reflection.

Re: Defining some stuff for each class in turn

2009-10-01 Thread Michel Fortin
On 2009-10-01 14:05:10 -0400, Max Samukha spam...@d-coding.com said: For example, the upcoming reflection mechanism in QtD (which uses its own metaobjects instead of the limited classinfo) requires manual insertion of a mixin into derived classes unless the mixin is inserted implicitly when a