The elegant idea:
rObject
.However, this requires types to be known at compile time. In turn, one would need to introduce all ROOT types to Asymptote. In principle, it shouldn't be a deep problem via Reflex. But, one would also need to implement type casts. In C++ one can do
TObject *o; TH1D *h; o = h; h = (TH1D *) o;
and an analogue of these casts need to be added to Asymptote. The first one o = h
should be, in principle, easy to implement. Whereas the second one is more complicated. One can judge only at runtime, whether the assignment is allowed or not – one would compare type of h (TH1D *) to o→IsA()
. So, one can imagine Asymptote code
TObject o; // in Asymptote object are technically pointers to the objects TH1D h; o = h; // this cast can be approved at compilation time h = o; // this shall be translated to a "dynamic cast" h = CastIfMatches(o, TH1D)