Mat Marcus
Tue, 02 Sep 2003 19:29:22 -0700
I hope you come back later... :-)For this reason, and for the fact that I have some upcoming deadlines at work, I'll summarize what I see and where I stand now, then I'll step back a bit for a while.
Extactly.Summary of thoughts on the existing optional: It now seems to me that the idea of the pointer-like interface wasn't so much to treat pointers and optionals uniformly. Rather, what I'm hearing is that the pointer-like interface was chosen because of the familiar syntax and idioms with regard to checking for initialization.
This will be provided in the next update.I can respect this set of design decisions, and optional in this form certainly has its uses. If optional<T> grows to allow more transparent co-existence with T (implicit construction, smooth tie interoperability) then I expect it will become even more useful.
Summary of thoughts on an alternative to optional: While optional offers much of what I need, I still have trouble with the pointer-like interface, largely for reasons of explainability. I believe that clients/maintainers of the libraries that I write would be distracted and confused by the a pointer-like interface or container-like ideas.
Hmmm. I certainly understand your concern about operators * and-> But I don't see what's wrong with container-like ideas. I bet it is easier to explain that optional<T> is a container that has a T or is empty than that it is a disciminated union of T and nil_t. After all, containers are everyday structures, yey variants are not.
This will be supported by the next update.* Interface driven by the desire to replace "dumb variables" with "smart variables" -- that is variables that check that they've been initialized before use, offer smooth interoperability with dumb T's (e.g. assignment and implict operations where sound).
* Backdoor to uninitialized storage available, e.g. unsafe_reference()
What do you need this for? (provided direct assignment is supplied)
* Works reasonably well with tie()
This will be covered.
- Mat _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost