Boost logo

Boost Users :

From: Joel de Guzman (joel_at_[hidden])
Date: 2008-01-07 07:32:37


Tobias Schwinger wrote:
> Joel de Guzman wrote:

>>> What are we going to do with that Variant? Switch again and go back
>>> where we're coming from?
>> Use the variant visitor. That may amount to the same thing, but
>> in this case, we have a value, not a function that returns a value.
>>
>>> It might but isn't necessarily what we want.
>> Why not?
>
> Because we're just coming from inside the switch and if we wanted to do
> something conditionally we could have done it there. Variant, Any,
> Optional or some non-union type can all make sense, depending on what
> we're up to.

This is not always the case. Many times, you don't supply
the functions or have control over them. That's specially true
if you are a library writer, you know that ;-)

Anyway, I agree with you, not in the standpoint of what is
a better API, but in the standpoint of practicality. Many
languages do switch the /variant/ way. But in our case, the
variant will indeed be a burden that might not be needed. So,
I am for "you pay only for what you need".

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