[C++-sig] implicitly_convertible / virtual base class

David Abrahams david.abrahams at rcn.com
Wed Jun 5 02:11:17 CEST 2002


From: "Achim Domma" <achim.domma at syynx.de>


> > -----Original Message-----
> > From: c++-sig-admin at python.org [mailto:c++-sig-admin at python.org]On
> > Behalf Of David Abrahams
>
> > > >     template <class T>
> > > >     def_implicit(args<T>);
> > >
> > > I would prefer this one.
> >
> > Why?
> >
> > So far I am leaning towards an interface that works more like C++
> > (implicit
> > is the default, "explicit_" is explicitly specified). I think people
> > writing wrappers will typically be looking over their C++ interface, so
it
> > would be most natural to write:
> >
> >     def_init(args<...>, explicit_)
>
> Your wrote in a previous mail, that this could be 'dangerous'.

It's only as dangerous as what you get in C++ by default.

> I usually
> prefer to let user make his error actively, because they can not blame me
> then. But it's true that one could expect the same behavior as in C++ as
> default, so this version might be more intuitive.

One other possibility: we could dispense with explicit_ (except possibly as
a way for the Python user to prevent the registration of an implicit
conversion that exists in C++) and simply create the implicit conversion if
the single argument type is convertible to the class type being wrapped.
That fact is detectable in C++ ;-)

> > It would be faster to implement it myself. However, the documentation
will
> > be a PITA as usual. Would you like to contribute a doc patch?
>
> What does PITA mean?

Pain in the <censored>... er, posterior.

> If you want me to update the documentation according to
> your changes, I will try my best. I think you are aware of the fact, that
> I'm not a native speaker. Do you write the documentation 'by hand' or do
you
> use a tool?

I do it by hand.

If I don't have to add "explicit_", a sentence or two of change in the docs
would do, and for that I wouldn't need your help.

OK, I'll give it a shot tomorrow.

-Dave







More information about the Cplusplus-sig mailing list