From: joel de guzman (isis-tech_at_[hidden])
Date: 2001-05-30 10:42:51
From: "Vladimir Prus" :
> 4. Polymorphism.
> >> If I understood Douglas correctly, he proposes just the opposite :-).
> >> I really don't think that runtime polymorphism will cost much -- it is
> >> used in the most critical parts.
> >Actually, I'm agreeing with Joel on this :). We'd be better off with
> >(compile time) polymorphism as far as we can take it.
> What's motivation? As I stated in point 1 above, Grammar::Symbol is
> completely non performace critical. The only other place where 'virtual'
> appears is 'reduction' method. Think we need some profiling there.
It's not just the performance. It is also the flexibility. The Spirit
framework uses compile time polymorphism as much as possible.
My experience is that pointers (needed for runtime polymorphism)
are *not* needed anymore. The type says it all. And arbitrary types
can be composes and structured, using template techniques, to
form more complex types.
Thus there is no *encapsulating* class in the Spirit framework,
such as the BNF class in your proposal, that is needed to manage
the lifetime of the rules. Rules are stand-alone in the Spirit framework
and are dealt with by value, instead of by pointer or reference, which
would otherwise require garbage collection or reference counting,
which is another potential performance problem to take into scrutiny.
Have a nice day, or evening, or afternoon, :-)
Joel de Guzman
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk