I'll now slowly answer the great replies I got in this thread, in
chronological order. Since I read them all before replying, I might
sometimes refer to future posts. Hopefully that won't be too confusing.
Andrei

On 21/05/2010 19:15, Andrei Alexandrescu wrote:
> I'll now slowly answer the great replies I got in this thread, in
> chronological order. Since I read them all before replying, I might
> sometimes refer to future posts. Hopefully that won't be too confusing.
>
> Andrei
Following the dcollection thread, it seems that your argument is that
Interfaces in a non hierarchical collection library are useless.
Or : Hierarchical collection libs are nonsense and ergo interfaces are
obsolete.
ok Some collection types belong to the same family. So they should be
loosely coupled. How to do that without having Interfaces ?
Next f.i. forwardranges belongs to a certain family of collections. and
Ranges are (or should be) Interfaces.
You see me very confused.
Bjoern
given
struct node
class col : IFWRange
node Node;
// No ?

Hello BLS,
> ok Some collection types belong to the same family. So they should be
> loosely coupled. How to do that without having Interfaces ?
How about this: Make a flat family of collections. Name the methods so that
across the lib, the same name does the same kind of thing and different names
do different kinds of things. Then define a flat family of whatever interfaces
are useful and have each class derive from all the interfaces they happen
to implement (but don't go out of your way to make anything fit).
--
... <IXOYE><

BCS:
> Maybe the style rule should be: dynamic arrays and AA's should be passed
> as const or ref.
Something like that must be enforced by the compiler, or the design of arrays/AAs must be changed.
Bye,
bearophile

On 05/22/2010 12:20 PM, bearophile wrote:
> BCS:
>> Maybe the style rule should be: dynamic arrays and AA's should be passed
>> as const or ref.
>
> Something like that must be enforced by the compiler, or the design of arrays/AAs must be changed.
>
> Bye,
> bearophile
It's not a very good rule anyway:
void inc_all(int[] xs) {
foreach (ref x; xs) {
x += 1;
}
}
Wouldn't gain anything from ref, and wouldn't work with const.