|
Boost : |
From: Hans Dembinski (hans.dembinski_at_[hidden])
Date: 2019-11-12 10:32:46
> I don't like this syntax, it is awkward and making the code less readable.
>
> 1) You are replacing a normal switch, which may be limited in its abilities but is well known even to beginners with something that has a rather unintuitive syntax. The shift operators are associated to streaming in C++ these days, but you use them differently here. Someone who reads this code who is not familiar with eswitch will not immediately understand this. Why did you chose operator>> instead of operator<< ? I think the choice is arbitrary and therefore hard to remember.
>
> 2) Your syntax requires one to type a lot of characters. I don't think one should replace the switch but if one did, the following syntax would be more economic and easier to remember, because it is less arbitrary
>
> eswitch( value, case(match1), lambda1, case(match2), lambda2 , ⦠, default(), lambdaN );
PS: I forgot to replace `case` by `case_` and `default` by `default_` but you get the idea.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk