Re: How to make invariant switchable

2009-06-19 Thread Max Samukha
On Fri, 19 Jun 2009 05:31:14 -0400, Christian Kamm wrote: >Max Samukha Wrote: >> You have a point. With current dmd, you can include unittests in the >> release build. So why not asserts? But I don't think it's a good >> solution to force people who don't want asserts in a final product to >> pre

Re: How to make invariant switchable

2009-06-19 Thread Christian Kamm
Christian Kamm Wrote: > LDC has the -enable-* and -disable-* command line options for asserts, array > bounds > checking, invariants and contracts to allow fine grained control over what is > emitted and > what isn't. Ah, Jarrett had already pointed that out. Anyway, what I meant to say was th

Re: How to make invariant switchable

2009-06-19 Thread Christian Kamm
Max Samukha Wrote: > You have a point. With current dmd, you can include unittests in the > release build. So why not asserts? But I don't think it's a good > solution to force people who don't want asserts in a final product to > prepend each and every assert with 'debug'. For assertions that shou

Re: How to make invariant switchable

2009-06-19 Thread Max Samukha
On Thu, 18 Jun 2009 13:43:22 -0400, bearophile wrote: >Max Samukha: >> Why would you want to leave asserts in a release build while they are >> supposed to be used for debugging? > >If you look around on internet you will find lot of people that like to keep >assertions in the final programs too

Re: How to make invariant switchable

2009-06-18 Thread Lars T. Kyllingstad
bearophile wrote: Max Samukha: Why would you want to leave asserts in a release build while they are supposed to be used for debugging? If you look around on internet you will find lot of people that like to keep assertions in the final programs too. Is DMD itself compiled with asserts left i

Re: How to make invariant switchable

2009-06-18 Thread bearophile
Max Samukha: > Why would you want to leave asserts in a release build while they are > supposed to be used for debugging? If you look around on internet you will find lot of people that like to keep assertions in the final programs too. Is DMD itself compiled with asserts left inside? When DMD do

Re: How to make invariant switchable

2009-06-18 Thread Max Samukha
On Thu, 18 Jun 2009 19:28:41 +0400, "Denis Koroskin" <2kor...@gmail.com> wrote: >On Thu, 18 Jun 2009 17:46:37 +0400, Max Samukha wrote: > >> On Thu, 18 Jun 2009 17:12:25 +0400, "Denis Koroskin" >> <2kor...@gmail.com> wrote: >> >>> On Thu, 18 Jun 2009 17:09:12 +0400, Qian Xu >>> >>> wrote: >>>

Re: How to make invariant switchable

2009-06-18 Thread Jason House
Qian Xu Wrote: > Release and Debug are two configuration sets. > > FEATURE | DEBUG | RELEASE > ---+---+- > assertion | | > ---+---+- > invariant | | > ---+---+- > debug symbols | | > -

Re: How to make invariant switchable

2009-06-18 Thread Denis Koroskin
On Thu, 18 Jun 2009 17:46:37 +0400, Max Samukha wrote: On Thu, 18 Jun 2009 17:12:25 +0400, "Denis Koroskin" <2kor...@gmail.com> wrote: On Thu, 18 Jun 2009 17:09:12 +0400, Qian Xu wrote: Denis Koroskin wrote: No, they wont. Is there any reason for that? I dont know. I'd prefer to wr

Re: How to make invariant switchable

2009-06-18 Thread Qian Xu
Release and Debug are two configuration sets. FEATURE | DEBUG | RELEASE ---+---+- assertion | | ---+---+- invariant | | ---+---+- debug symbols | | ---+---+- optimi

Re: How to make invariant switchable

2009-06-18 Thread Jarrett Billingsley
On Thu, Jun 18, 2009 at 8:57 AM, Qian Xu wrote: > Jason House wrote: > >> Qian Xu Wrote: >> >>> Hi All, >>> >>> "invariant" is a great language feature of D. But nice thing costs. >>> >>> Is it possible to make it compiler switchable? Like "dmd >>> --ignore-invariant" or "dmd --version=ignore-invar

Re: How to make invariant switchable

2009-06-18 Thread Max Samukha
On Thu, 18 Jun 2009 17:12:25 +0400, "Denis Koroskin" <2kor...@gmail.com> wrote: >On Thu, 18 Jun 2009 17:09:12 +0400, Qian Xu >wrote: > >> Denis Koroskin wrote: >>> >>> No, they wont. >> >> Is there any reason for that? > >I dont know. I'd prefer to write > >> debug assert(foo == bar, "foo must

Re: How to make invariant switchable

2009-06-18 Thread Denis Koroskin
On Thu, 18 Jun 2009 17:09:12 +0400, Qian Xu wrote: Denis Koroskin wrote: No, they wont. Is there any reason for that? I dont know. I'd prefer to write debug assert(foo == bar, "foo must be equal to bar"); if I'd like to turn them off in release mode.

Re: How to make invariant switchable

2009-06-18 Thread Qian Xu
Denis Koroskin wrote: > > No, they wont. Is there any reason for that?

Re: How to make invariant switchable

2009-06-18 Thread Denis Koroskin
On Thu, 18 Jun 2009 16:57:47 +0400, Qian Xu wrote: Jason House wrote: Qian Xu Wrote: Hi All, "invariant" is a great language feature of D. But nice thing costs. Is it possible to make it compiler switchable? Like "dmd --ignore-invariant" or "dmd --version=ignore-invariant" It think it

Re: How to make invariant switchable

2009-06-18 Thread Qian Xu
Jason House wrote: > Qian Xu Wrote: > >> Hi All, >> >> "invariant" is a great language feature of D. But nice thing costs. >> >> Is it possible to make it compiler switchable? Like "dmd >> --ignore-invariant" or "dmd --version=ignore-invariant" It think it will >> be quite helpful to generate t

Re: How to make invariant switchable

2009-06-18 Thread Jason House
Qian Xu Wrote: > Hi All, > > "invariant" is a great language feature of D. But nice thing costs. > > Is it possible to make it compiler switchable? Like "dmd --ignore-invariant" > or "dmd --version=ignore-invariant" It think it will be quite helpful to > generate test version and release versio