View mode: basic / threaded / horizontal-split · Log in · Help
June 03, 2004
newby question
does D support (or will support)?:

- introspection:
ie:
   - dynamical loading of class
   - dynamicall call of property / method (found method by name)

- automatic serialization !
   the natural offspring of introspection. any support planned ?

- runtime compilation (my program, from user instruction, create a new class
code, compile it and use it all while running !)

- attribute on field/method/other:
like:
 [AppearanceAttribute(Atype)]
 int anItProperty;
this is great for automatic processing of plugin, property panel, etc ...
June 03, 2004
Re: newby question
I'd also like to know.  I'm especially interested in:

- Dynamic classloading (by DLLs if need be, but preferably something more
self-contained and programmatic)
- Querying/invoking methods by name programmatically using strings

Anybody know?

-david

"Lloyd Dupont" <lloyd-D@galador.net> wrote in message
news:c9lqpt$ivo$1@digitaldaemon.com...
> does D support (or will support)?:
>
> - introspection:
> ie:
>     - dynamical loading of class
>     - dynamicall call of property / method (found method by name)
>
> - automatic serialization !
>     the natural offspring of introspection. any support planned ?
>
> - runtime compilation (my program, from user instruction, create a new
class
> code, compile it and use it all while running !)
>
> - attribute on field/method/other:
> like:
>   [AppearanceAttribute(Atype)]
>   int anItProperty;
> this is great for automatic processing of plugin, property panel, etc ...
>
>
>
>
June 03, 2004
Re: newby question
Lloyd Dupont wrote:

>does D support (or will support)?:
>
>- introspection:
>ie:
>    - dynamical loading of class
>  
>
You could try COM.

>    - dynamicall call of property / method (found method by name)
>
>- automatic serialization !
>    the natural offspring of introspection. any support planned ?
>  
>
Walter Said " I do intend to expand the 'classinfo' so that one could 
figure out all the fields and methods of a class. However, I spent some 
time trying to figure out how to make dynamic class loading work with 
some special compiler magic, but it isn't going to happen. The stumbling 
block is not knowing at compile time what the type of an expression is.

I could wave the magic spec wand and say that all methods in a dynamic 
class must return void and that data fields are not possible, but such 
restrictions make it not so useful. "

Automatic serialization would be a easy to add to the base class then.


>- runtime compilation (my program, from user instruction, create a new class
>code, compile it and use it all while running !)
>  
>
That would be nice but that is a script language. It would be possible 
to compile DLL's from you application and then use them.  It would be 
nice if there was a lib written to help out here.

>- attribute on field/method/other:
>like:
>  [AppearanceAttribute(Atype)]
>  int anItProperty;
>this is great for automatic processing of plugin, property panel, etc ...
>  
>

Obviously a factory (ie COM) could be used but some kinda support 
(parhaps a library) for this would be nice.

-- 
-Anderson: http://badmama.com.au/~anderson/
June 03, 2004
Re: newby question
Lloyd Dupont schrieb:

> does D support (or will support)?:

No, at a current time it doesn't support any of the features below. It 
follows a static model, which makes most of what you propose technically 
not very feasible. Many people have been interested in such features 
however, and hence you could expect that some of them would get 
implemented in D 2.0.

> - introspection:
> ie:
>     - dynamical loading of class
>     - dynamicall call of property / method (found method by name)

No, the only thing we could offer now is, that you define an interface, 
and load classes from DLL by that interface. An example implementation 
is in DUI (GTK user interface library), i believe.

Calling a method by name may be also interesting for binding in 
scripting languages, especially if the calling convention was changed to 
be more python-like (an array of run-time typed variables), however this 
requieres other improvements to the language, such as automatic boxing, 
and would probably be misused often, making D software as slow as most 
Java software is. :/

> - automatic serialization !
>     the natural offspring of introspection. any support planned ?

This was supported in DLI, the experimental compiler from Burton Radons. 
 You could inspect the class fields, and there was an example utomatic 
serializer implementation. This extension is also useful to garbage 
collector, and other things. However, the current DMD and GDC compilers 
don't support it. If you were brave, you could try to reimplement this 
feature from DLI into GDC, and DMD could take it from there. I'm not 
brave enough for that any longer. Or we could ask the GDC maintainer 
whether he'd be interested to do that. The corresponding newsgroup is D.gnu.

> - runtime compilation (my program, from user instruction, create a new class
> code, compile it and use it all while running !)

No, no. We assume that for most purposes when you need that, you could 
just as well requiere the user to have a D compiler at hand. Otherwise, 
a scripting languege version of D would be interesting to do. However, 
it wouldn't be so nice to use unless we get a dynamic calling of a 
property as above.

> - attribute on field/method/other:
> like:
>   [AppearanceAttribute(Atype)]
>   int anItProperty;
> this is great for automatic processing of plugin, property panel, etc ...

What is this? Please explain.

-eye
June 03, 2004
Re: newby question
Ilya Minkov wrote:

> Lloyd Dupont schrieb:
> 

> 
>> - attribute on field/method/other:
>> like:
>>   [AppearanceAttribute(Atype)]
>>   int anItProperty;
>> this is great for automatic processing of plugin, property panel, etc ...
> 
> What is this? Please explain.

C# stuff:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vclrfcsharpattributes.asp


Bruno.

> 
> -eye
June 03, 2004
Re: newby question
> > - attribute on field/method/other:
> > like:
> >   [AppearanceAttribute(Atype)]
> >   int anItProperty;
> > this is great for automatic processing of plugin, property panel, etc
...
>
> What is this? Please explain.
>
right now I'm writting (for an app (in ... whisper... c#)) a 'form editor'
where a user could put some predefined control and edit it's property.

my first option was to hard code all accepted editor and how to edit their
property. I dismiss this as being too cumbersome (beside my stress boss
gives me only 1 week to finish this 6 month projet)

so I same up with an other idea. in .. (the above mentioned language) you
could tag each field/method/class like that
[atag]
void mymethod()
{
// body..
}
and discover the tag by introspection.

then what I do in my form editor, no single widget is hardcoded, I simply
browse my dll/exe for type tagged with [Decoration] and show all the
property tagged with [Appareance(category)] thus I could add anytime new
editor at no cost :-)

this is just an example, there is plenty of other !
although it does requires introspection.
June 05, 2004
Re: newby question
This sounds like the Java Beans stuff... is that esentially correct?

John

On Fri, 04 Jun 2004 08:47:54 +1000, Lloyd Dupont wrote:

>> > - attribute on field/method/other:
>> > like:
>> >   [AppearanceAttribute(Atype)]
>> >   int anItProperty;
>> > this is great for automatic processing of plugin, property panel, etc
> ...
>>
>> What is this? Please explain.
>>
> right now I'm writting (for an app (in ... whisper... c#)) a 'form editor'
> where a user could put some predefined control and edit it's property.
> 
> my first option was to hard code all accepted editor and how to edit their
> property. I dismiss this as being too cumbersome (beside my stress boss
> gives me only 1 week to finish this 6 month projet)
> 
> so I same up with an other idea. in .. (the above mentioned language) you
> could tag each field/method/class like that [atag]
> void mymethod()
> {
> // body..
> }
> and discover the tag by introspection.
> 
> then what I do in my form editor, no single widget is hardcoded, I simply
> browse my dll/exe for type tagged with [Decoration] and show all the
> property tagged with [Appareance(category)] thus I could add anytime new
> editor at no cost :-)
> 
> this is just an example, there is plenty of other ! although it does
> requires introspection.
June 07, 2004
Re: newby question
I'm not sure, I haven't use JavaBean in a while.
I remember there was some convention to have automaticallly editors, etc ...
but C# attribute are way more easier !

"DemmeGod" <me@demmegod.com> wrote in message
news:pan.2004.06.05.01.04.01.599244@demmegod.com...
> This sounds like the Java Beans stuff... is that esentially correct?
>
> John
>
> On Fri, 04 Jun 2004 08:47:54 +1000, Lloyd Dupont wrote:
>
> >> > - attribute on field/method/other:
> >> > like:
> >> >   [AppearanceAttribute(Atype)]
> >> >   int anItProperty;
> >> > this is great for automatic processing of plugin, property panel, etc
> > ...
> >>
> >> What is this? Please explain.
> >>
> > right now I'm writting (for an app (in ... whisper... c#)) a 'form
editor'
> > where a user could put some predefined control and edit it's property.
> >
> > my first option was to hard code all accepted editor and how to edit
their
> > property. I dismiss this as being too cumbersome (beside my stress boss
> > gives me only 1 week to finish this 6 month projet)
> >
> > so I same up with an other idea. in .. (the above mentioned language)
you
> > could tag each field/method/class like that [atag]
> > void mymethod()
> > {
> > // body..
> > }
> > and discover the tag by introspection.
> >
> > then what I do in my form editor, no single widget is hardcoded, I
simply
> > browse my dll/exe for type tagged with [Decoration] and show all the
> > property tagged with [Appareance(category)] thus I could add anytime new
> > editor at no cost :-)
> >
> > this is just an example, there is plenty of other ! although it does
> > requires introspection.
>
Top | Discussion index | About this forum | D home