Topic: Q: class declaration at runtime


Author: volker.moerke@ithh.sh.sub.de (Volker M"orke)
Date: Sun, 18 Sep 94 00:00:00 CET
Raw View
Dear C++ experts,

I have a problem found during my diploma thesis.

Is it possible to give a class declaration to a program at run
time (!), so that the set of classes known by this program is
enhanced?

A language server is to be implemented, which should allow the user to
describe new classes (of graphical objects). These classes shall
become known to the server at run time, and therefore enhance the set
of known classes of the language (server) at run time.

I hope, I was able to make clear, what I want!?

If this problem can not be solved with C++, I would appreciate any
hint, which other programming language can!

PLEASE send your answers as PMs, because I don`t read all of these
boards/areas/echoes regularly! Thank you. Of course I will post a
summary of all the answer I will get.

Greetings.
Volker
  _     _   _______
 //\   //| /_____ /|  Informationstheater Hamburg - Die Informationszentrale
 \\ \ || || __ __| |  SysOp-Team................volker.moerke@ithh.sh.sub.de
  \\ \|| || ||_/ | |  V+49-40-60680346Q.............(privat V+49-40-407580Q)
   \\_|| || |    | |  ------------------------------------------------------
    \__|/ |/     |/   Volker M"orke..................Creative Computing e.V.





Author: sriram@tcs.com (Sriram Srinivasan)
Date: 19 Sep 1994 03:08:26 GMT
Raw View
In article <ue6BoMD8BaozF@v_moerke.ithh.sh.sub.de>, volker.moerke@ithh.sh.sub.de (Volker M"orke) writes:
: Is it possible to give a class declaration to a program at run
: time (!), so that the set of classes known by this program is
: enhanced?
:
: A language server is to be implemented, which should allow the user to
: describe new classes (of graphical objects). These classes shall
: become known to the server at run time, and therefore enhance the set
: of known classes of the language (server) at run time.
:
: I hope, I was able to make clear, what I want!?
:
: If this problem can not be solved with C++, I would appreciate any
: hint, which other programming language can!
:

Do you really need new different *classes* of objects at runtime ?
The reason I ask this is that declaring a class only determines an
interface to a certain  functionality - does the user implement the
methods at run time ?

Can this problem be parametrized in any way, so instead of specifying
new classes, the user only specifies different combinations of parameters
For example, the edge of a compound object may be determined by any number
of primitive objects such as lines, splines and arcs . The user then
construct any kind of shape ...

If you do want the user to write C++ code, and if you want this to be
added dynamically during run-time, look at "Advanced C++ Programming
Styles and Idioms" by James Coplien (Addison Wesley) . There are too many
dangers and portabiliity issues involved with this approach, to make such
an interface available to the end user.

The alternative is to embed scripting in your application, and one that
supports object oriented features. TCL (Tool Command Language) is one such
option, and supports numerous extensions for object oriented programming.

-Sriram
(sriram@tcs.com)