Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-11-24 17:38:51


"Peter Dimov" <pdimov_at_[hidden]> writes:

> David Abrahams wrote:
>> Gabriel Dos Reis <gdr_at_[hidden]> writes:
>>
>>> David Abrahams <dave_at_[hidden]> writes:
>>>
>>>> Brian McNamara <lorgon_at_[hidden]> writes:
>>>>
>>>>> I feel like most C++ programmers have become so accustomed to the
>>>>> "happy accident of structural conformance" that they think it is
>>>>> the common case. It's not. Aside from functionality named by (1)
>>>>> operators or (2) a handful of common names that have fallen into
>>>>> common usage (like "swap" and "clone"), the chances that
>>>>> some-random-library-
>>>>> is-going-to-just-happen-to-present-an-interface-which-exactly-
>>>>> structurally-conforms-to-the-concepts-you-developed-independently
>>>>> are nearly zero.
>>>>
>>>> Most C++ programmers do seem to miss this.
>>>
>>> I don't think that is a fair characterization.
>>
>> Touchy, touchy, Gaby! No need to get defensive of the whole
>> community! It's been my personal experience, in discussing the
>> potential problems with ADL, that most of the C++ programmers I've
>> spoken with seem to feel that it's just as likely as not that a random
>> unqualified call which conforms structurally is exactly the right
>> thing. I've had to pull out the above argument several times in the
>> past few years.
>
> But did you consider the possibility that those C++ programmers feel that
> way because in their experience random unqualified calls that conform
> structurally usually _were_ the right thing?

It's possible, but nobody I've spoken to claims to have experienced
such a happy accident. They just said they were worried about
imposing extra work for the programmer in cases when happy accidents
would've worked out just fine.

> In other words, isn't it possible that the "chances that ... are nearly
> zero" assertion above is incorrect, and that the happy accident of
> structural conformance _is_ really the common case?

Of course, anything's possible. I'm just giving my opinion based on
my experience. I, of course, have experienced the unhappy kind of
accident, and I've seen it come up several time with other people as
well.

Regardless, even if the happy accidents were more common than the
unhappy ones, it is my inclination to design things so that
programming happens intentionally, rather than by accident. But
then, I don't use Perl much ;-)

-- 
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