[Prev][Next][Index][Thread]

Re: Can one do the following in dylan?




Bruce and Hugh thanks for the prompt answers. But <wink>

Bruce Hoult wrote:

> In article <3AC0C8D1.ED20B44C@inf.ethz.ch>, Samuele Pedroni 
> <pedroni@inf.ethz.ch> wrote:
> 
> 
>> [the motivation of this mail is really intellectual curiousity, not to
>> start a flamewar, java
>> is not my language-of-choice, I have not such a thing]
>> 
>> In java the following is possible:
>> 
>> <Plugin.java>
>> public interface Plugin{
>> 
>>   public void init();
>> 
>>   public Object do(Object action);
>> 
>> }
>> </Plugin.java>
>> 
>> <Foo.java>
>>  ...
>>   Plugin plugin = (Plugin)Class.forName(pluginName).newInstance();
>>   // pluginName is the "name"  of a up to runtime unknown and separately
>> compiled class
>>   // implementing the Plugin interface
>>  ...
>> </Foo.java>
>> 
>> Is something like that (*language-aware* dynamic loading, no C low-level
>> shared library stuff)
>> possible in dylan? (AFAIK no but ...)
> 
> 
> You can't do it from a textual name.
> 
> But if you have dynamically loadable libraries then the init code in 
> those libraries should be adding appropriate methods to appropriate open 
> generic functions, including methods on "make()".  So if you then get 
> hold of a reference to a class object from that library -- perhaps as 
> the result of calling some function in that class -- then the client 
> code can happily create instances of that class.
> 
> -- Bruce
I'm a bit lost, is that a yes or a no answer. Can I load those dll programatically
at runtime... is there a dynamic-load function that can load
a textually referred dll.

Let be concrete with an example.

Can one write a servlet server in dylan? having both the servlets and 
the server being written in dylan and working together at dylan level, 
not at some lower level (COM or other components framework).
It should be possible to compile servlets separately from the server
which should meet (link with) them lately at runtime without being
aware of them at its compilation time.

[Or are you simply referring to the fact that a dylan lib can be 
deployed as dll and one can compile his code against such a dll
but that must be known at compilation time?]

One can write such a server in java, python, a lisp system with eval
or better load (of compiled code) or eventually compile present in a 
deployed runtime, I imagine in Objective-C,... in C(++) it would be 
painful because
language level dynamic linking here is low-level dynamic linking ;).
What's the situation with dylan?

regards, Samuele Pedroni.






Follow-Ups: References: