User Tools

Site Tools


en:prog:asyroot_alternative

An alternative to the current interface concept

The elegant idea:

  1. Method calls would be implemented as virtual fields of rObject.
  2. The Asymptote compiler, when matching the expression to a list of known functions, would include also the list of ROOT methods (via Reflex).

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)
en/prog/asyroot_alternative.txt · Last modified: 2012/02/10 10:59 (external edit)