Thorsten Behrens wrote:
Stephan writes:

I vaguely remember having discussed this before with Daniel Bölzle,
but neither of us can remember whether there were any serious problems
with it.

Well, will of course try this on a full build ;-)

Whether or not the constructor should be explicit might be a
question of style, however.

Don't think so. To match behaviour of plain ptrs (for the implicit
conversion), the copy constructor needs to be non-explicit. After all,
having that taking place automatically is my whole point here.

I do not think that the situation is that simple. In my opinion, there are three possibilities, not two:

First, the current situation where you have to use the potentially expensive Reference<XBase>(xDerived,UNO_QUERY_THROW) or the non-obvious, abstraction-breaking xDerived.get() or Reference<XBase>(xDerived.get()) to up-cast from XDerived to XBase.

Second, the explicit option where you have to use the explicit Reference<XBase>(xDerived) for the up-cast.

Third, the implicit option you proposed where you can implicitly use xDerived for the up-cast.

That the third most closely mimics plain pointers does not automatically qualify it as the best solution. Too much implicit conversion can make code too obscure and fragile, as we probably all have learned the hard way.

-Stephan

[...]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to