Boost logo

Boost :

From: Cory Nelson (phrosty_at_[hidden])
Date: 2007-09-02 13:30:02


On 9/2/07, David Abrahams <dave_at_[hidden]> wrote:
>
> on Sat Sep 01 2007, Chris Lattner <clattner-AT-apple.com> wrote:
>
> > On Sep 1, 2007, at 2:14 PM, David Abrahams wrote:
> >> on Sat Sep 01 2007, Chris Lattner <clattner-AT-apple.com> wrote:
> >>
> >>> Can you give me a specific example of where making the entire lexer a
> >>> template would be more useful than adding a couple of virtual method
> >>> calls? It isn't meaningful to lex anything other than a sequence of
> >>> char's
> >>
> >> You're serious? It's meaningless to lex UTF-32?
> >
> > It's not meaningless, but templatizing the entire lexer (which
> > includes the preprocessor) is not necessarily the best way to achieve
> > this.
>
> Granted. It was just the first example that popped into my head. My
> point was simply that, if you're interested in creating a flexible
> toolkit out of which people can build systems with the highest
> efficiency, static polymorphism in its interfaces is a virtual (no pun
> intended) necessity.

Seconded. In the end when it comes to libraries choice wins out, and
templates can achieve this with no cost to performance, size, or
cleanliness.

And it's not like you can't make iterators that do buffered virtual
transcoding of *->UTF-8 like was discussed if the machine code size of
the primary frontend is what you're after.

-- 
Cory Nelson

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk