On Mon, 2010-06-28 at 16:08 -0700, Ian Lance Taylor wrote:
> Basile Starynkevitch <bas...@starynkevitch.net> writes:
> 
> > * I don't know exactly what should be wished with respect to templates.
> > Tom Tromey (in CC) have a wonderful insight in
> > http://gcc.gnu.org/ml/gcc/2010-06/msg00143.html but I probably did not
> > understood all the details & the consequences. In particular I don't
> > understand if the mark method in his example has to be supplied or
> > generated.
> 
> In Tom's interesting idea, we would write the mark function by hand for
> each C++ type that we use GTY with.
> 
> One way to make this approach work for plugins would be to write
> 
> template<typename T>
> void
> mark(T& t)
> {
>   t->mark();
> }
> 
> Then every plugin which invents new garbage collected types would have
> to define a mark method for them.

Isn't that precise statement a good use case for virtual methods?

In other words, for that trick to work for plugins, don't we require the
mark() method above to be virtual?

I would be delighted with that, but I understood that many people don't
want to have virtual methods.

Maybe I misunderstood?

Cheers
-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***


Reply via email to