I am looking for real world (open source) examples (or algorithms) that modify a specific class of an object (or variable) at runtime.
An example of this behavior in Java might look like a snapshot of the code below. Here, LinkedList , which works well in the context of frequent insertions and / or deletions, changes to ArrayList , which works well in the context of random access and iteration.
List myList = new LinkedList(); ... myList = new ArrayList( myList );
The above Java example changes between LinkedList and ArrayList for the sake of performance.
However, examples in any language, for any data structure, using any technique * and for any reason are welcome.
* Technique: simple and simple, as in the example above, or using become: in SmallTalk or __class__ in Python or ...
source share