digitalmars.D - Reflection would be really nice
- "Frank Benoit (keinfarbton)" <benoit tionex.removethispart.de> Apr 19 2007
- Walter Bright <newshound1 digitalmars.com> Apr 19 2007
- "Frank Benoit (keinfarbton)" <benoit tionex.removethispart.de> Apr 19 2007
- Sean Kelly <sean f4.ca> Apr 19 2007
- Walter Bright <newshound1 digitalmars.com> Apr 19 2007
- "Frank Benoit (keinfarbton)" <benoit tionex.removethispart.de> Apr 19 2007
- Walter Bright <newshound1 digitalmars.com> Apr 19 2007
- "Vladimir Panteleev" <thecybershadow gmail.com> Apr 20 2007
- "Frank Benoit (keinfarbton)" <benoit tionex.removethispart.de> Apr 19 2007
- torhu <fake address.dude> Apr 19 2007
- Dan <murpsoft hotmail.com> Apr 19 2007
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:allClasses is already there, see Classinfo.find().
Didn't know about it :)
It was added in 1.011 (IIRC), so that's not surprising :-) Sean
Apr 19 2007
Frank Benoit (keinfarbton) wrote: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()"?
In the module info, there should be an array of the static constructors.
Apr 19 2007
Walter Bright schrieb:Frank Benoit (keinfarbton) wrote: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()"?
In the module info, there should be an array of the static constructors.
I cannot use them, because of circular dependencies. This is, why i "manually" call "static_this()" methods (note the underscore) in a defined order.
Apr 19 2007
Frank Benoit (keinfarbton) wrote:Walter Bright schrieb:Frank Benoit (keinfarbton) wrote:allClasses is already there, see Classinfo.find().
Now i can test if "org.eclipse.swt.SWT.SWT" exists. If so, is there a way to call the static method "static_this()"?
I cannot use them, because of circular dependencies. This is, why i "manually" call "static_this()" methods (note the underscore) in a defined order.
There isn't a way to do that with reflection at the moment.
Apr 19 2007
On Fri, 20 Apr 2007 01:39:12 +0300, Frank Benoit (keinfarbton) <benoit tionex.removethispart.de> wrote:Walter Bright schrieb:Frank Benoit (keinfarbton) wrote: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()"?
In the module info, there should be an array of the static constructors.
I cannot use them, because of circular dependencies. This is, why i "manually" call "static_this()" methods (note the underscore) in a defined order.
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.com
Apr 20 2007
Walter Bright schrieb: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().
Where can i find the ClassInfo DDoc? It seems, it disappeared from http://www.digitalmars.com/d/phobos/object.html
Apr 19 2007
Frank Benoit (keinfarbton) wrote:Walter Bright schrieb: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().
Where can i find the ClassInfo DDoc? It seems, it disappeared from http://www.digitalmars.com/d/phobos/object.html
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. ;)
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









Sean Kelly <sean f4.ca> 