All asserts need to have messages attached! Explicit as possible!

Moritz Maxeiner via Digitalmars-d digitalmars-d at puremagic.com
Mon Jul 10 10:17:08 PDT 2017


On Monday, 10 July 2017 at 13:52:22 UTC, Jacob Carlborg wrote:
> On 2017-07-10 15:45, Jonathan M Davis via Digitalmars-d wrote:
>
>> [...]
>
> Well, in this case it could include why the range cannot be 
> empty.

If either the name of the function was non-descriptive or the 
function's documentation string (and assert messages are also 
just documentation) doesn't make it obvious why, sure.

> But in the case of ranges it's pretty clear, if you know how 
> the whole range concept works.

Even if you don't know about ranges, the function's name (pop*, 
remove*, extract*, etc.) virtually always implies a state 
mutating operation removing something.



More information about the Digitalmars-d mailing list