September 07, 2006
Craig Black wrote:
> Nice work!  Does DDL do dynamic class loading?
> 
> -Craig 
> 
> 

Yes, but not in the Java sense of the word - at least not yet. ;)

At the moment, DDL operates that the module/library level.  Once you have that loaded (.obj, .lib, .o, or what have you) and linked, then you interrogate it for what symbols it provides.  So it's operating a slightly lower level than we'd prefer.  However, this is a level at which Java is clear as mud, so I'd like to think that this approach is much more modifiable and extensible.

In the case of finding class information, you can use the template methods exposed on the DynamicLibrary class to find a particular ctor or ClassInfo, or use the ExportClass template for a more well-honed approach.

I'll take the opportunity here to note one other important difference between Java and D/DDL.  Due to D's design as a statically compiled language, one cannot achieve lazy class loading at every call to 'new'.  Instead, every external reference that a given module has, must be resolved during a link pass before that library can be safely used.

In essence: The same drawbacks that exist at "compile-and-link time" are the same as at "run-and-link time".

Anyway, the Linker class helps with the above - any call to a link() method will  result in an Exception if the library in question cannot be fully resolved.

-- 
- EricAnderton at yahoo
September 09, 2006
pragma schrieb:

> ---------------
> So what is DDL?
> ---------------
> 
> DDL stands for "D Dynamic Libraries"  ..... an interface for dynamic reflection ....
???  Please explain. What the heck is dynamic reflection.

A more concrete question. How DDL could help to implement f.i. a plugin architecture for, let's say, an IDE.
Thanks in advance.
Björn
September 09, 2006
BLS wrote:
> pragma schrieb:
> 
>> ---------------
>> So what is DDL?
>> ---------------
>>
>> DDL stands for "D Dynamic Libraries"  ..... an interface for dynamic reflection ....
> ???  Please explain. What the heck is dynamic reflection.

http://en.wikipedia.org/wiki/Reflection_(computer_science)


> A more concrete question. How DDL could help to implement f.i. a plugin architecture for, let's say, an IDE.
> Thanks in advance.
> Björn

http://www.dsource.org/projects/ddl/wiki/AboutDDL
^ at the bottom of the page, in the 'No more DLL Files ?' section.
September 09, 2006
BLS wrote:
> A more concrete question. How DDL could help to implement f.i. a plugin architecture for, let's say, an IDE.
> Thanks in advance.
> Björn

To exapand on what Tom said, I can see DDL helping an IDE's design in a few innovative ways.

First of all, DDL can put an IDE directly in touch with the compiler's output.  This means that the .obj files from a build pass can be loaded back into the IDE and parsed for type information, which then can then be used for intellisence.

Once DDL is expanded to include debug information and line numbers, one could allow a developer to click on a symbol and go to where it is defined.

Another thing is that DDL can be used for a plugin architecture.  As a D IDE is already "compiler aware", plugins could be coded from within the IDE itself in a manner indistinguishable from using a scripting language.  The environment would simply compile the plugin "scripts" once they're saved and pull the .obj files directly into the runtime in one step.

- Eric


September 09, 2006
Thanks Tom,
still have some problems to understand (the sense of) dynamic relection, but anyway thanks for the links.
Björn
Make it as simple as possible, but not simpler! Niklaus Wirth
September 09, 2006
Hi Eric,


> First of all, DDL can put an IDE directly in touch with the compiler's
> output.  This means that the .obj files from a build pass can be
> loaded  back into the IDE and parsed for type information, which then > can then be used for intellisence.
> Once DDL is expanded to include debug information and line numbers,
> one  could allow a developer to click on a symbol and go to where it  > defined.

This simply means: DDL will probabely enable all IDE guys to create : Not invented here, not yet seen (tm) IDEs. <vbg>

> The environment would simply compile the plugin "scripts"
> once they're saved and pull the .obj files directly into the runtime
> in  one step.

I can't await your "Advanced Usage tutorials". I hope that you will include a simple sample showing how to implement a plugin-architecture using DDL.
Especially  "Dynamically Linking a Class" would be very interresting.

( An  : Enhancing a class form within a DDL module would be IMO the most interesting part !)

Kind regards,
Björn

September 09, 2006
pragma schrieb:
> This means that the .obj files from a build pass can be
> loaded  back into the IDE and parsed for type information, which then > can then be used for intellisence.

Do you have any plans to make an example, or at least some general instructions  available ?
Thanks in advance ,
Björn
September 09, 2006
BLS wrote:
> pragma schrieb:
>  > This means that the .obj files from a build pass can be
>  > loaded  back into the IDE and parsed for type information, which then  > can then be used for intellisence.
> 
> Do you have any plans to make an example, or at least some general instructions  available ?
> Thanks in advance ,
> Björn

I sincerely apologize for the lack of documentation at this stage.  I'm working as quickly as I can to get things put together so you can move along - this goes especially for the advanced stuff.

For now, I can say that the very heart of the system is the DynamicLibrary class, and the template methods provided there.  Follow that, and the basic tutorials on the site and you have about 90% of the whole concept.  Everything else is really to help with various use strategies: performance, deployment, and complex linking schemes.

As far as the concept goes for my last post, it's more a matter of looking at a given .lib or .obj file as a symbol table, instead of just a way to dynamically load code.  You wouldn't even need to use the Linker - just load the file directly via the LoaderRegistry and ask it some questions.

For an example of this, take a look at ddlinfo (and it's sourcecode). Or, just download the binary and run it against a few .obj files you have lying around for an idea of the potential here.

- Eric
September 09, 2006
Thanks, i guess this will allready help a lot. I  suggest to  place the DDLInfo hint on the DDL frontpage.

Björn
1 2
Next ›   Last »