
Fernando Cacciola wrote:
Rob Stewart wrote:
From: "Fernando Cacciola" <fernando_cacciola@hotmail.com>
I wonder what would be the result of the following thought experiment: Please, answer the questions _without_ looking at the answers, and if possible post your initial results; then compare with the answers.
IANAOU either (yet!), but I'll give my answers.
First, I'll describe what I think the right behavior is; this may be exactly how optional works now or it may not be. I haven't compared this description to optional's documentation.
OK. You just described Joel's proposed behaviour, and, from your test results, it's clear that at least you wouldn't be confused about the fact that in one case it binds while in the other it doesn't. Now I wonder how would that be in real code... I mean, in my example you could infer from the context that 'o' was null in one of the cases... but what if you can't tell that? you wouldn't be able from context alone to know the expected effect of assignment. That's real problem don't you agree?
For the record, that is not exactly my proposed behaviour. I am objecting to *any* form of bind/rebind *from assignment*. Maybe that was not clear (as I noticed from Peter Dimov's reply) but what I am advocating is bind only at construction time (see my reply to Peter Dimov). Anyway, I like the new direction this is heading into (i.e. no assigment from T and the reset(), reset(nil), reset(T) syntax). Regards, -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net