[Tutor] SEC: UNCLASSIFIED:-dynamic binding of functions

Taro.Ogawa.73439858@navy.gov.au Taro.Ogawa.73439858@navy.gov.au
Tue, 21 Dec 1999 16:36:59 +1000


How do I add a function ("method"?) to a class on the fly?
ie: the name and contents of the function is unknown at compile time,
but needs to be built at runtime from various bits of information.

Alternatively, is there a way to run function foo at compile time to
do the same thing? This is more than just macro expansion.
(Probably not, but ... )

[This is needed for serious syntactic sugar to avoid the need for
10-50 lines per affected class (I can't just subclass since the
needed functions are slightly different for each affected class)
where 1 line would do; it'll be run-once for each affected class
and I'm willing to have a small speed hit as part of the startup

Thanks, --OH.