std.collection - changing the collection while iterating

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 23 12:31:01 PDT 2015


On Tuesday, 23 June 2015 at 19:13:43 UTC, Jeremy Powers wrote:
> On Mon, Jun 22, 2015 at 8:39 PM, philippecp via Digitalmars-d < 
> digitalmars-d at puremagic.com> wrote:
>
>>
>> I think the best approach is the following:
>> * Throw exceptions on debug (usability)
>> * Leave undefined on release (performance)
>>
>
> Please no.
>
> Different behavior between release and non is not something to 
> be desired.

It's perfectly normal if we're talking about assertions, but in 
that case, it's an AssertError being thrown, not a normal 
exception. So, in either case, it's a logic error; it's just that 
you get better reporting of it in debug mode than in release and 
don't have the cost of doing the checking in release.

- Jonathan M Davis


More information about the Digitalmars-d mailing list