Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

tango.core.Array.contains comments

Please state your comments and issues here appended by your name/username. Thanks.

KeYeR-L from this point there are number (from contains to differenceOf in the documentation) of functions where stays:

"Both setA and setB are required to be sorted."

first of all the condition here is very strong, because it is a necessary thing for those functions to work properly, but is "lost something in the crowd" of other informations. It should be underlined or made another way to make it be noticeable.

the second thing here is that even when we assume that before first use the coder will see the description (but sometimes he will just see and say "oh! cool, union of 2 arrays, cool, lets see... taking 2 arrays, and optional pred and making 1, OK, no need to check more, back to coding!") but after some time he will remember the name but probably there is a chance he will forget about the condition. Is there any way of keeping him aware of that?

it could be like ..

Elem[] unionOf (Elem[] setA, Elem[] setB, Pred2E pred = null);


Elem[] unionOf (Elem[] setA, Elem[] setB, Pred2E pred = null, bool Asorted=true, bool Bsorted=true);

with addition that they will be sorted if there is a report they are not

but that's not very neat...

another thing could be basic debug quick assert tests of random elements if they in appropriate order and toss an exception.. but then it would be not deterministic..

so again a great features on arrays, but i'm afraid people will forget about the sorted restriction.

larsivi See ticket #276