How collection definition is interpreted?
A collection has two flavors: declarative and procedural. From declarative point of view it defines a set of items. From procedural point of view it is a loop through all elements of the collection. This loop can be written as follows: foreach(s in SourceCollection) { /* do something */ } In SQL the procedural part is almost not present (yet it exists in such languages as T/SQL and PL/SQL). There is always some trade off between these two interpretations: the declarative approach is simple and convenient for interactive use while the procedural is powerful and provides full control over the database. COQL tries to combine these two interpretations (to the extent it is possible). For that purpose we have to be able to view the whole collection definition as one unit and at the same time to control all the peculiarities of its syntax and semantics. It is important to understand that in general case declarative approach does not allow us to define an arbitrary collection (easily) so at on