comp.lang.ada
 help / color / mirror / Atom feed
From: antonio_duran@hotmail.com (Antonio Duran)
Subject: Re: runtine instanciation
Date: 17 Jun 2002 03:07:06 -0700
Date: 2002-06-17T10:07:06+00:00	[thread overview]
Message-ID: <e1a50f2.0206170207.6a38d4e0@posting.google.com> (raw)
In-Reply-To: aehr7g$716kk$1@ID-77047.news.dfncis.de

Dmitry A.Kazakov <mailbox@dmitry-kazakov.de> wrote in message news:<aehr7g$716kk$1@ID-77047.news.dfncis.de>...
> Immanuel Scholz wrote:
> 
> > Hello again,
> > 
> > In Ada, can create a class at runtime? Like the getClass().forClass() in
> > Java.
> > 
> > As example create a variable from the type entered by the user at runtime.
> 
> I am not sure what you want, but I suppose that Ada.Streams is what you 
> need. In short it allows you to create a class-wide object from some 
> external source (like user input) without a factory. Or better to say the 
> factory is distributed over the implementations of 'Input/'Read attributes.

I'm not a Java expert I think that Java construct allows you to
provide the name of a .class file (or a jar) that was not binded to
your application at compile time, when you call that method, the
virtual machine searches the CLASSPATH and if the .class (or .jar) is
found they are loaded and binded to your application. This is not
supported by any Ada language construct.

That dynamic loading is a nice to have feature but has some problems.
For example, if you have more than one version of that class there is
the possibility of loading the wrong one.

Retrieving a persistent object by using Ada.Streams allows you to
create an object that was previously saved but the packages that
contain the code for that class must be previously compiled and linked
into your application. That is also true for C and C++.

You can achive dynamic object loading by using object models like COM
or CORBA (assuming the existence of support for these models as Ada
libraries). For example, COM provides support for dynamic object
loading (CreateObject) through what they call 'late binding'.
Registering a component attach a class name (or identification) to a
DLL, the DLL is brought to memory when CreateObject is invoked and by
employing an introspection mechanism the application is able to know
what are the properties, methods and events in the class and the
infraestructure provides support for dynamic dispatching function
calls (through RPC mechanisms) to the DLL functions. I think CORBA
works, more or less, in a similar way.

    Antonio Duran



      parent reply	other threads:[~2002-06-17 10:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-15 11:43 runtine instanciation Immanuel Scholz
2002-06-15 15:20 ` Simon Wright
2002-06-16 23:07 ` Dmitry A.Kazakov
2002-06-17  3:16   ` Robert C. Leif
2002-06-17 22:04     ` Dmitry A.Kazakov
2002-06-17 14:54       ` Robert C. Leif
2002-06-17 21:16         ` Robert I. Eachus
2002-06-18 22:35         ` Dmitry A.Kazakov
2002-06-17 10:07   ` Antonio Duran [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox