[phobos] std.array.ilength
David Simcha
dsimcha at gmail.com
Thu Feb 17 06:55:21 PST 2011
On Thu, Feb 17, 2011 at 9:14 AM, Andrei Alexandrescu <andrei at erdani.com>wrote:
> I'm not sure I see the improvement over a cast. If anything it makes
> everything more comfy and therefore riskier.
>
> What's wrong with to!int(arr.length)? It's safe too.
>
>
Too verbose and (because of runtime checks) inefficient for something that's
safe 99.999% of the time and useful fairly often in practice. IDK if it's
just my programming style but I use arrays of indices into other arrays all
the time. Really, when's the last time you worked with an array over 2
billion elements long (or 4 billion if we go with uint)? It's just
frustrating to put up with all these formalities in the overwhelmingly
common cases (where array.length < int.max is a safe assumption) for added
safety in the extremely rare case where it's not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/phobos/attachments/20110217/46846e4d/attachment.html>
More information about the phobos
mailing list