The point I'm trying to make is that a trivial translation to an if else chain is not the only realistic choice. What you propose is non trivial and, in a few minuets of thinking I've already thought of a number of ways it breaks the expected semantics of the classic switch statement (it can end up with worse than linear cost for one) and a small slew of potential issues. Personably, I don't see the value in it. It sits on an odd kind of place where it has a statically defined number of options but they are dynamically defined as to what they are. I rather suspect that in most cases both of these will be static or dynamic.

I've never had a case where I needed to use the construct you describe and I can think of ways to get the same effect without the potential for problems. As a result, I think you have set your self a really hard task of arguing that it has more advantages than problems.


Reply via email to