Dave Gomboc <[EMAIL PROTECTED]> writes: > [Fernando Cacciola] >> The most fundamental point is that being Haskell a pure functional >> language there is no possibly undefined behaviour to worry about, >> so Maybe doesn't need to address this issue as optional<> does. > ... and later ... >> I account the possibly undefined behavior of accesing an uninitialized >> optional as a real and important problem. > > You can get rid of the possibly undefined behaviour by defining it! Throw > an exception when there's an attempted coercion from nil/undefined to a > normal value.
That could have a significant negative impact on performance and code size, FWIW. >> The * syntax is not supposed to make optional<> pretend it is a pointer. >> It is clearly not and the documentation says so quite clearly, I think. >> And if it doesn't, then it is the documentation that needs to be fixed. > > No, the interface should be changed, because it _looks_ like it has pointer > semantics. So do the proxies required by input iterators over classes and a few other such proxy pointers. They all contain the value they "point at". IMO get<X>(y) is the solution to this problem. > But they are iterators, and random-access iterators exhibit pointer > semantics. That's the reason iterators use operator* and operator-> in the > first place! Input iterators also contain the values *they* reference. -- Dave Abrahams Boost Consulting www.boost-consulting.com _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost