Boost logo

Boost Users :

From: Joel de Guzman (joel_at_[hidden])
Date: 2008-01-11 04:55:27


Steven Watanabe wrote:
> AMDG
>
> Tobias Schwinger <tschwinger <at> isonews2.com> writes:
>
>>> Now that that's cleared, let me /push/ now the other benefits
>>> of my proposed interface:
>>>
>>> * Ability to allow fall-through and break:
>>>
>>> case_<1>(f1, break_), // no fall-through
>>> case_<2>(f2), // fall-through (by default)
>>>
>>> * Allow multiple case handling:
>>>
>>> case_<'x', 'y'>(f2), // handle 'x' and 'y'
>>>
>> This stuff is pretty cool. But it -again- makes me think we are in fact
>> talking about two different kinds of switch tools: One that can be used
>> manually with lots of syntactic sugar - and another one that's mean and
>> lean and doesn't have to be that pretty because it's intended to be fed
>> its input in form of an automatically computed sequence, anyway...
>
> I'm inclined to agree.
>
> Regarding multiple case handling,
> there have to be two layers. The outer layer exposed to
> the user has to separate everything into separate cases,
> possibly using a no-op function that falls through. Expanding
> the sequence seems a bit too heavy weight for me. I would
> at least want to have the internal dispatching function
> exposed directly so that those who don't need this kind of
> fanciness don't have to pay for it.

Again, please post to both lists. I almost missed this post.

Ok, if you are willing to incorporate these into the switch_
library, as a separate layer. I'd be happy to change my vote.
I'm sure we all agree that I've presented valid points that
need to be addressed. I don't think we need another library
to have these implemented. I wouldn't mind a dual layer library.
Layers are good.

Regards,

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

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net