Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-02-19 15:58:57


"Ed Brey" <brey_at_[hidden]> writes:

>> Incidentally, no Boost.Python user has reported confusion about
>> extract, and they tend to be slightly more naive than the average
>> Boost user.
>
> Unfortunately, that data point is of limited use, since Python has a
> lot of names leaving something to be desired (generally those borrowed
> from C and Unix). When I was a Python newby, insetad of complaining,
> I just got used to looking up functions in the docs to be sure I knew
> what they did.

Are you kidding? Python users (almost) never read docs!
{sorry all you other Python users out there; it's just my impression}.

>>> I agree the issues goes beyond member vs. free. By the way, what
>>> is the motivation for using free over a member function?
>> For one thing, the lovely template keyword:
>>
>> var.template extract<T>(); ^^^^^^^^^
>
> Let me make sure I undestand the context here: the template keyword is
> used iff var is a template parameter, right?

No, iff it's a template parameter or dependent on one.

> That seems like a minor use case to me.

Not to me. I'll probably only use variant in a dependent context.

> It doesn't make sense to give up the strong OO correlation that a
> member function provides just because of a keyword in a minor use
> case. This is especially true considering that a free function
> could be provided in addition for the template case.
>
> I know the "strong OO correlation" phrase can launch into the debate
> over whether member functions really make for better OO, which I don't
> want to go into. I'm just looking at existing practice with the
> standard library container classes. If you want to get a piece of the
> contents of those containers, you use a member function.

It's easy to make this case if you assume dependent variants are an
edge case.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk