Boost logo

Boost :

From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2004-05-06 04:33:54

Pavol Droba writes:
>> > You are not quite right. Sequence concept is precisely defined in C++ standard.
>> Yes, and that's unfortunate, because it is essentially a dead
>> concept -- "nobody" writes generic code that relies on it -- that
>> has occupied a good name. In fact, "Collection" is exactly the word
>> that would perfectly fit to describe what the standard choose to
>> refer to as "Sequence". I don't think going the other way around
>> would be a good call. In CS terminology, collections are inherently
>> associated with storage; using the term to name the concept that
>> explicitly aims at representing sequences that do not necessarily
>> have any is IMO a bad idea.
>> > Collection traits are not implementig this concept, they don't
>> > even implement full Container concept. So if would be very
>> > misleading to use the name of it. Collection traits are working
>> > with structures that model Collection concept, therfore they
>> > should be named after it IMHO.
>> "Collection" is an unfortunate name for the concept. Not having
>> "Sequence" at our disposal, it should be called "Iterator Range" or
>> something along these lines.
> Well I cannot judge the standard naming, however I think, that some
> standardization is better then none. So if there is a definition we
> should change the standard of stick to it. Later is probably more
> feasible.

I wasn't suggesting to re-define the standard's Sequence concept to
mean what we want (although that's not entirely impossible). Rather, I
was saying that "Collection" is a bad substitute for the occupied

> I found collection easy to understand. I don't understand what is
> wrong with it.

There is nothing wrong with the word per se. It just has a commonly
accepted meaning that is in conflict with the definition we are giving
to the identically named concept. In particular, like I said earlier,
"Collection" commonly implies storage, while the concept in question
specifically aims to represent sequences that don't have any.
Compare, for instance, and

> It very well fits into the standard concept hierarchy
> Collection < Container < Sequence
> < Associative container

Looks like a total mess to me. If anything, it should be

    Sequence < Collection < Container
                          < Associative Container
             < View

> Unlike container, that have an ownership of its elements, collection
> might be just a reference to values. So it describes a "collection"
> of values organized in an arbitrary structure.

That's not a correct definition of the concept we are trying to name,
though. The "structure" might not even exists -- think 'range_view(0,
100)', for instance. Which only exemplifies my point; the word has
wrong connotations.

> Collection concept specifies an interface to
> access these values.

I understand what the definition of the concept is. I am saying that
its _name_ is unfit and misleading.

Aleksey Gurtovoy
MetaCommunications Engineering

Boost list run by bdawes at, gregod at, cpdaniel at, john at