On Thu, Feb 17, 2011 at 9:14 AM, Andrei Alexandrescu <[email protected]>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.
_______________________________________________ phobos mailing list [email protected] http://lists.puremagic.com/mailman/listinfo/phobos
