From: Joel de Guzman (djowel_at_[hidden])
Date: 2003-08-29 23:29:51
Dave Gomboc <dave_at_[hidden]> wrote:
>> Right now I am questioning whether the
>> pointer-like semantics is worth it to me. I would probably prefer that
>> clients type more to test whether a value is initialized so that they
>> can type less to call a function that takes an optional as a parameter
>> when they have a value to pass in. Sorry if this has already been
>> covered, but here my question is: Have you experimented with a variant
>> of optional that drops the pointer-like semantics, allowing implicit
>> construction and disallowing implicit safe-bool conversion, and if so
>> what did you learn that made you favor the current set of tradeoffs?
> I've never been comfortable with the pointer-like semantics of optional. If
> you don't need an industrial-strength solution like Fernando's, perhaps
> something simple like the below would be sufficient? (Also, feel free to
> suggest improvements.)
FWIW, I too am not happy with the pointer-like semantics of optional.
I'd be very interested to know the pros and cons. Are there actual
experiences without the pointer-like semantics? I honestly believe that
optional should follow the "maybe" or "variant<T, none>" semantics.
The concepts are very pure, yet, the pointer-like semantics uglifies it
<< I thought I was the only one who find the pointer-like unlikeable so
I kept my silence on the matter >>
-- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net