Boost logo

Boost :

From: Joel de Guzman (joel_at_[hidden])
Date: 2003-10-17 10:46:08


John Torjo <john.lists_at_[hidden]> wrote:
> In the docs for lambda, at a point, Joel de Guzmann suggested a better
> syntax for control structures, namely:
>
> if_(condition)[then_part]
> if_(condition)[then_part].else_[else_part]
> while_(condition)[body]
> do_[body].while_(condition)
> for_(init, condition, increment)[body]
>
> I strongly prefer this, but the same could be done for switch_statement,
> which is pretty huge otherwise:
>
> switch_(condition)
> .case_<label1>[lambda_expression]
> .case_<label2>[lambda_expression]
>
> What do you think?

Not possible. case_<label1>[lambda_expression] is a
syntax error.

Phoenix-2 will have:

    switch_(condition)
    [
        case_(label1)[expr1],
        case_(label2)[expr2],
        case_(label3)[expr3]
        default_[expr4]
    ]
        
This was already discussed at great lengths but somehow, the implementation
fell through the cracks. Spirit is already using this syntax since Hartmut Kaiser
implemented the switch_p deterministic parsers.

Cheers,

-- 
Joel de Guzman
http://www.boost-consulting.com
http://spirit.sf.net

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