Re: contracts in interfaces: do they work, do I have to do something to enable checking of contracts ?

2018-10-01 Thread Alex via Digitalmars-d-learn
On Monday, 1 October 2018 at 13:49:53 UTC, Emil wrote: I am trying my hand at contracts and they work fine in plain functions and in methods, but I can't make them work in interfaces. https://dlang.org/spec/interface.html#interface-contracts $ dmd --version DMD64 D Compiler v2.081.1 Copyright

contracts in interfaces: do they work, do I have to do something to enable checking of contracts ?

2018-10-01 Thread Emil via Digitalmars-d-learn
I am trying my hand at contracts and they work fine in plain functions and in methods, but I can't make them work in interfaces. https://dlang.org/spec/interface.html#interface-contracts $ dmd --version DMD64 D Compiler v2.081.1 Copyright (C) 1999-2018 by The D Language Foundation, All Rights

Re: contracts in interfaces

2012-12-15 Thread Yann
Thanks for your reply! I'll investigate further and report a bug if necessary.

Re: contracts in interfaces

2012-12-14 Thread Ali Çehreli
On 12/14/2012 12:11 AM, Yann wrote: >>> why does this produce a segmentation fault when executed: There are quite a few bugs about interface contracts and inherited contracts: http://d.puremagic.com/issues/buglist.cgi?quicksearch=interface+contract Although, I haven't seen one about segmen

Re: contracts in interfaces

2012-12-14 Thread Yann
Thanks for your reply! @property uint n(); n() needs to be const: @property uint n() const; Ok. Why is that? why does this produce a segmentation fault when executed: I don't know, you should show us a more complete minimal code that shows the segfault. Here you go (I stripped it do

Re: contracts in interfaces

2012-12-13 Thread bearophile
Yann: could someone tell me what the problem(s) with the following are? //why does this not compile: out(g) { assert(g.n == end - start); } @property uint n(); n() needs to be const: @property uint n() const; why does this produce a segmentation fault when executed: I don't

contracts in interfaces

2012-12-13 Thread Yann
Hi, could someone tell me what the problem(s) with the following are? Also, how do I make "$" work with the slice operator? Thanks a lot. interface Graph { bool opIndex(uint u, uint v) in { assert(u < n && v < n); } Graph opSlice(uint start, uint end) in { assert(start < n && end <=