digitalmars.D - Reflection would be really nice
- Frank Benoit (keinfarbton) (38/38) Apr 19 2007 A little hello world in SWT is actually bigger then 7 MB.
- Walter Bright (2/8) Apr 19 2007 allClasses is already there, see Classinfo.find().
- Frank Benoit (keinfarbton) (3/5) Apr 19 2007 Didn't know about it :)
- Sean Kelly (3/6) Apr 19 2007 It was added in 1.011 (IIRC), so that's not surprising :-)
- Walter Bright (2/8) Apr 19 2007 In the module info, there should be an array of the static constructors.
- Frank Benoit (keinfarbton) (4/13) Apr 19 2007 I cannot use them, because of circular dependencies. This is, why i
- Walter Bright (2/14) Apr 19 2007 There isn't a way to do that with reflection at the moment.
- Vladimir Panteleev (5/18) Apr 20 2007 Speaking of circular dependencies, those are quite annoying. Would it be...
- Frank Benoit (keinfarbton) (4/13) Apr 19 2007 Where can i find the ClassInfo DDoc?
- torhu (3/17) Apr 19 2007 It's missing from the 1.010 docs (which are one the web currently), but
- Dan (2/35) Apr 19 2007 That's simpler (inside) : )
- BLS (5/20) Apr 21 2007 Still hope that you realize that Frank is going to make a zillion lines ...
- Dan (3/6) Apr 22 2007 Actually, I think Reflection is going to be the biggest feature added to...
A little hello world in SWT is actually bigger then 7 MB. This is due to the generated reflection code, and the need to pull in the whole SWT in the initialization phase. With rudimentary reflection, this would be much better. I also think, there would be many application possible with this kind of stuff. class ClassInfo{ Field[] fields; Method[] methods; Constructors[] constructors; static ClassInfo[] allClasses; // probably the most important } class Field{ uint offset; TypeInfo type; Attribute[] attribs; char[] name; void* getPtr( Object* obj ); } class Parameter{ char[] name; TypeInfo type; Attribute[] attribs; } class Method{ uint offset; TypeInfo ret_type; Attribute[] attribs; char[] name; Parameter[] params; void* getPtr( Object* obj = null ); } class Constructor{ Attribute[] attribs; char[] name; void* getPtr(); Parameter[] params; }
Apr 19 2007
Frank Benoit (keinfarbton) wrote:class ClassInfo{ Field[] fields; Method[] methods; Constructors[] constructors; static ClassInfo[] allClasses; // probably the most important }allClasses is already there, see Classinfo.find().
Apr 19 2007
allClasses is already there, see Classinfo.find().Didn't know about it :) Now i can test if "org.eclipse.swt.SWT.SWT" exists. If so, is there a way to call the static method "static_this()"?
Apr 19 2007
Frank Benoit (keinfarbton) wrote:It was added in 1.011 (IIRC), so that's not surprising :-) SeanallClasses is already there, see Classinfo.find().Didn't know about it :)
Apr 19 2007
Frank Benoit (keinfarbton) wrote:In the module info, there should be an array of the static constructors.allClasses is already there, see Classinfo.find().Didn't know about it :) Now i can test if "org.eclipse.swt.SWT.SWT" exists. If so, is there a way to call the static method "static_this()"?
Apr 19 2007
Walter Bright schrieb:Frank Benoit (keinfarbton) wrote:I cannot use them, because of circular dependencies. This is, why i "manually" call "static_this()" methods (note the underscore) in a defined order.In the module info, there should be an array of the static constructors.allClasses is already there, see Classinfo.find().Didn't know about it :) Now i can test if "org.eclipse.swt.SWT.SWT" exists. If so, is there a way to call the static method "static_this()"?
Apr 19 2007
Frank Benoit (keinfarbton) wrote:Walter Bright schrieb:There isn't a way to do that with reflection at the moment.Frank Benoit (keinfarbton) wrote:I cannot use them, because of circular dependencies. This is, why i "manually" call "static_this()" methods (note the underscore) in a defined order.In the module info, there should be an array of the static constructors.allClasses is already there, see Classinfo.find().Didn't know about it :) Now i can test if "org.eclipse.swt.SWT.SWT" exists. If so, is there a way to call the static method "static_this()"?
Apr 19 2007
On Fri, 20 Apr 2007 01:39:12 +0300, Frank Benoit (keinfarbton) <benoit tionex.removethispart.de> wrote:Walter Bright schrieb:Speaking of circular dependencies, those are quite annoying. Would it be possible to add a module/static constructor modifier keyword like "standalone" (doesn't depend on the static constructors of imported modules) or "depends" (which allows to enumerate the modules this [module's] static constructor[s] depend on)? -- Best regards, Vladimir mailto:thecybershadow gmail.comFrank Benoit (keinfarbton) wrote:I cannot use them, because of circular dependencies. This is, why i "manually" call "static_this()" methods (note the underscore) in a defined order.In the module info, there should be an array of the static constructors.allClasses is already there, see Classinfo.find().Didn't know about it :) Now i can test if "org.eclipse.swt.SWT.SWT" exists. If so, is there a way to call the static method "static_this()"?
Apr 20 2007
Walter Bright schrieb:Frank Benoit (keinfarbton) wrote:Where can i find the ClassInfo DDoc? It seems, it disappeared from http://www.digitalmars.com/d/phobos/object.htmlclass ClassInfo{ Field[] fields; Method[] methods; Constructors[] constructors; static ClassInfo[] allClasses; // probably the most important }allClasses is already there, see Classinfo.find().
Apr 19 2007
Frank Benoit (keinfarbton) wrote:Walter Bright schrieb:It's missing from the 1.010 docs (which are one the web currently), but reappeared in 1.011. So it's probably in your dmd/html folder. ;)Frank Benoit (keinfarbton) wrote:Where can i find the ClassInfo DDoc? It seems, it disappeared from http://www.digitalmars.com/d/phobos/object.htmlclass ClassInfo{ Field[] fields; Method[] methods; Constructors[] constructors; static ClassInfo[] allClasses; // probably the most important }allClasses is already there, see Classinfo.find().
Apr 19 2007
Frank Benoit (keinfarbton) Wrote (MODIFIED BY ME)struct ClassInfo{ Field[] fields; Method[] methods; Constructors[] constructors; static ClassInfo[] allClasses; // probably the most important } struct Field{ uint offset; TypeInfo type; Attribute[] attribs; char[] name; void* getPtr( Object* obj ); } struct Parameter{ char[] name; TypeInfo type; Attribute[] attribs; } struct Method{ uint offset; TypeInfo ret_type; Attribute[] attribs; char[] name; Parameter[] params; void* getPtr( Object* obj = null ); } struct Constructor{ Attribute[] attribs; char[] name; void* getPtr(); Parameter[] params; }That's simpler (inside) : )
Apr 19 2007
Still hope that you realize that Frank is going to make a zillion lines of JAVA code available for the D community. Even if TIOPORT is far away from beeing perfect... this tool has probabely an bigger impact as we can imagine right now. Ergo : Work hard <as ususal> to enable Java like reflection and forget about the super duper D++ features for a while <to be continiued Bjoern Walter Bright Wrote:Frank Benoit (keinfarbton) wrote:Walter Bright schrieb:There isn't a way to do that with reflection at the moment.Frank Benoit (keinfarbton) wrote:I cannot use them, because of circular dependencies. This is, why i "manually" call "static_this()" methods (note the underscore) in a defined order.In the module info, there should be an array of the static constructors.allClasses is already there, see Classinfo.find().Didn't know about it :) Now i can test if "org.eclipse.swt.SWT.SWT" exists. If so, is there a way to call the static method "static_this()"?
Apr 21 2007
BLS Wrote:Still hope that you realize that Frank is going to make a zillion lines of JAVA code available for the D community. Even if TIOPORT is far away from beeing perfect... this tool has probabely an bigger impact as we can imagine right now. Ergo : Work hard <as ususal> to enable Java like reflection and forget about the super duper D++ features for a while <to be continiuedActually, I think Reflection is going to be the biggest feature added to D since 1.0; it'll let us easily build context sensitive code generators within D; as we saw with that FPU vector optimization code that was in here a few days ago. If we get that in order, I could very readily see SSE2 and graphics optimization code generators being written in D; which would blow C++ game support out of the water.
Apr 22 2007