Boost logo

Boost :

From: Hubert HOLIN (Hubert.Holin_at_[hidden])
Date: 2001-05-21 17:07:25


Paris (U.E.), le 21/05/2001

--- In boost_at_y..., "Vesa Karvonen" <vesa.karvonen_at_h...> wrote:

[SNIP]

> following is copied from the book for exposition.
>
> istream& operator>>(istream& s, complex& a)
> /*
> input formats for a complex ("f" indicates a floating point number):
> f
> (f)
> (f,f)
> */
> {
> // 16 lines of code implementing the operator
> }
>
> Now lets turn the comment into pseudo code:
>
> istream& operator>>(istream& s, complex& a)
> {
> Terminal<double> re, im;
> Parser parser = re
> | '(' + re + ')'
> | '(' + re + ',' + im +')'
> ;
>
> s >> parser;
>
> return complex(re,im);
> }
>
> The above pseudo code is something I dreamed in early 1999.
>
> > Template metaprograms are very hard to write, debug and use.
>
> True, but the problems are solvable and the benefits are clear.

        Hey I *WANT* that!

        Actually, had it not been for the need for self-containment (for
my proposed Boost libraries), the input iterator for quaternions and
octonions for use in my programs would most likely have been written
with, say, PCCTS (despite its somewhat current akward stance), and the
C++ code generated from that.

        Having the ability to code thus within a legitimate C++ fragment
would be invaluable to me.

        There is a caveart though: the grammar, especially for octonions,
is rather rich in ambiguities. With PCCTS I have means to lift the
ambiguities (to make choices), and it would be necessary (for my use)
that equivalent means be available here.

                Hubert Holin
                Hubert.Holin_at_[hidden]


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