To me it seems that #1 is the "natural" approach given what we currently do.
While going with #2 seems to be more light-weight and "better" to me for
arrays, it will both introduce a somewhat distinct implementation for
polymorphic scalars and arrays and will also not work with the approach of
doing everything (or mostly everyting?) at the front-end level -- at least
it seems thus to me.
I do not know what to recommend, but if you go for #2, I would think about a
way to nicely use a "similar" technique also for polymorphic scalars if
possible.
Of course it would be nice to treat all the cases in one consistent
framework. If one decides for #2 as the superior approach, then one
could in principle unify the treatment of polymorphic scalars + arrays
by using an array descriptor also for scalar classes (basically array
descriptors and class containers are similar concepts anyway). This
would introduce a bit of memory overhead, since the array descriptor
includes fields which are not needed for scalars. However, one would
gain in consistency.
Btw, another asymptotic aim for our OOP implementation could be to
have consistency/interoperability with C++ classes. However, I
presently have too little knowledge of the implementation of
poylmorphism in g++ to say anything more concrete about this topic at
this point (any pointers in this direction are welcome, though).