What about putting array.empty in object.d?
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Wed Mar 21 19:07:45 PDT 2012
On 3/21/12 6:56 PM, Jonathan M Davis wrote:
> Except that containers shouldn't provide indexing if it's not efficient. And
> from what I've seen, it's far too common for programmers to check length == 0,
> and they end up doing it on stuff like linked lists where it _is_ inefficient.
> It's considered good practice in C++ to use empty rather than length for
> exactly the reasons that I've listed. D is no different in this regard.
In D it's poor style to define linear-time length. That's called walkLength.
Andrei
More information about the Digitalmars-d
mailing list