>>>I have tried that, not bad, but I want to find some "nicer" way.
>>
>>I think a "Factory Class/Object" is about as close as you can get, while still keeping things "tidy".
>
>Another way would be to have the class compiled in a .prg file, and have the .prg file built on the fly, and recompiled in the next run. Thus the process would go like this:
>- have the class definition in a .prg
>- have something instantiated from a subclass of that class
>- a method changes properties of the object, and then employs some combination of parser/generator to write a new .prg which would write a different version of the original .prg; this should be feasible because it's only .fxp that is kept open while an instance lives.
>- once all the instances of this class are released, compile the .prg (the fresh version).
>- ready for next run.
>
>The trick, of course, is in the parser/generator. The trouble it would take to write it is not worth it. If my zemljak volunteers to write it, I figure he'll have lot of fun doing it and less hair when he's done.
The parser/generator could be trivial ... one can "walk" an object in memory and generate a new Class definition that way.
But, since we're all still guessing as to the "why and what", ...
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement