Another idiom I wish were gone from phobos/druntime

Chris via Digitalmars-d digitalmars-d at puremagic.com
Fri Feb 6 11:09:47 PST 2015


On Friday, 6 February 2015 at 16:22:00 UTC, ketmar wrote:
> On Fri, 06 Feb 2015 15:59:04 +0000, Chris wrote:
>
>> Hm. But the compiler can check, if the signature is ok. E.g.
>
> "wtf, compiler, are you making fun of me? you KNOW what i mean, 
> yet you
> insisting that i have to please you... ah, fsck it! that shitty 
> feature
> never worth it anyway."
>
>   auto foo (int n) { ... }
>   auto foo (int n, int m) { ... }
>
>   // i'm soooo sleepy
>   contract {
>     auto foo (int n) {
>       ...
>     }
>     auto foo (int n, int m) {
>       ...check for foo(n) that i copipasted here
>       ...and completely forgot about it, 'cause
>       ...that "contract" clause is sooooo far away
>       ...from the function itself...
>     }
>   }
>
> and so on.
>
>> I like it, if things can be put aside in blocks, like unittest 
>> or debug.
>
> unittest and debug blocks are not parts of function contract, 
> that's why
> they can be separated. they are merely *checks*, not 
> *prerequisites*.

I would like to try, if it is really so bad. If laziness is an 
argument against it, it also applies to in {} and out {}, doesn't 
it?


More information about the Digitalmars-d mailing list