bug-commoncpp
[Top][All Lists]
Advanced

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

New By Name


From: Mike Papper
Subject: New By Name
Date: Tue, 23 Sep 2003 15:49:39 -0700

I would like the Java introspection functionality - or at least to be able to
create an instance of a class from its name. This would mean there is no need
for "Factories". I call this feature "new by name" because thats what is was
called in the "ThinkC" platform/language in the early 90s.

Has there been any discussion or ideas on a good way to do this? Again, in
the 90s we ported the ThinkC functionality to Windows and Solaris,HP,AIX. We
impemented this feature in C++ doing 3 things:
1) all classes inherited from a single base class (ThinkC and Java style)
2) Adding a macro to each header and source file that did some registration
stuff (so the name could be looked up ina  table to find the code to create
theobject)
3) forced the linker to link these object by explicitly declaring an instance
somewhere

An example on how to use it:
ChildClass cl = (ChildClass)new_by_name("Children_of_ChildClass");

--
Mike Papper
Fantastic
address@hidden
650-356-2113




reply via email to

[Prev in Thread] Current Thread [Next in Thread]