|
Boost : |
From: Ed Brey (brey_at_[hidden])
Date: 2003-02-19 15:30:03
David Abrahams wrote:
> "Ed Brey" <brey_at_[hidden]> writes:
>
>> Eric Friedman wrote:
>>>
>>>> The area would be helped by renaming extract to access.
>>> I tend to agree the name is confusing. So shall we call it
>>> boost::access<>? Input?
>>
>> Dave A.'s comment that access is confusing because it is a noun and a
>> verb is well taken. Of course, the same can be said for
>> extract. ;-)
>
> But not as plausibly, IMO.
Agreed. My comment about extract also being a noun was a joke. Technicalities aside, it is not subject to part of speech confusion the way access is. Semantic confusion still seems like a problem, however.
> 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.
>> 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? That seems like a minor use case to me. 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.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk