On 04/29/2015 09:15 PM, Jonathan M Davis wrote: > Yeah, but I think that it's safe to say that std.allocator is not the > normal case
std.allocator really isn't a general example. I'm exclusively using if (ary.length) or if (!ary.empty) in my code to avoid the problem. Occasionally I'm using if (auto ary = func()), despite the fact that the semantics are wrong, but it's nice and short and works as long a func always returns null instead of empty slices. But it's very fragile, hard to spot during debugging, and I already spent too many hours on that. So I'd expect any code analyzer to fault such usage and any D book to teach people not to use arrays as boolean, at which point we'd be better off to slowly remove it from the language.
