From: Itay Maman (itay_maman_at_[hidden])
Date: 2002-07-01 23:34:57
David Abrahams wrote:
> Oh, this is spooky. I am just implementing similar functionality in v2 of
> the Boost.Python library. In v1 it was called from_python.
> The problem: a Python object (usually managed via a PyObject*, but in
> Boost.Python managed with the wrapper class object) can in principle hold
> any C++ type. A major component of the Boost.Python library's
> is the extraction of C++ objects from Python objects, and the wrapping of
> C++ objects into Python objects.
> So, should I call my from_python function variant_cast<> as well? I don't
> think that reads well. In particular, I think of a cast as generally
> a peer-to-peer type transformation, whereas these "casts" are
> container-to-containee transformations. I was thinking of "extract":
> Now, "extract<>" might be too-general a name to use in namespace
> I'm not sure that it is. I do think it works better than
The Inheritance relationship is also a composition. So, the upcast of a
class D to its base class B, may also be referred to as 'extracting' B
out of D. Nonethless, this primitive is widely known as casting.
I think the same logic should be applied here: Althought we are actually
extracting a held value, we may still use 'variant_cast' to describe the
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk