Another idiom I wish were gone from phobos/druntime

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Fri Feb 6 08:22:00 PST 2015


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*.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20150206/b3f8215b/attachment.sig>


More information about the Digitalmars-d mailing list