www.digitalmars.com         C & C++   DMDScript  

D - Versioning

reply "Vathix" <vathix dprogramming.com> writes:
If I do this
version(!SOMEVERSION) { foo(); }
the compiler has error:  identifier or integer expected, not !
shouldn't we be able to do that instead of:
version(SOMEVERSION) {} else { foo(); }
Same thing with debug.
Aug 28 2003
next sibling parent reply "Matthew Wilson" <matthew stlsoft.org> writes:
Yes. Am surprised we cannot.

We should also be allowed to write

version (Onething, Another, AndMore)
{
}
else version (Different, Weirder)
{
}
else
{
}

Though I do not know whether we can or can't. Enlightenment needed ... :-)

"Vathix" <vathix dprogramming.com> wrote in message
news:biknge$em4$1 digitaldaemon.com...
 If I do this
 version(!SOMEVERSION) { foo(); }
 the compiler has error:  identifier or integer expected, not !
 shouldn't we be able to do that instead of:
 version(SOMEVERSION) {} else { foo(); }
 Same thing with debug.

Aug 29 2003
parent reply "Vathix" <vathix dprogramming.com> writes:
Interesting, although I think it might be better using && and || operators.


"Matthew Wilson" <matthew stlsoft.org> wrote in message
news:bink34$1sqv$1 digitaldaemon.com...
 Yes. Am surprised we cannot.

 We should also be allowed to write

 version (Onething, Another, AndMore)
 {
 }
 else version (Different, Weirder)
 {
 }
 else
 {
 }

 Though I do not know whether we can or can't. Enlightenment needed ... :-)

 "Vathix" <vathix dprogramming.com> wrote in message
 news:biknge$em4$1 digitaldaemon.com...
 If I do this
 version(!SOMEVERSION) { foo(); }
 the compiler has error:  identifier or integer expected, not !
 shouldn't we be able to do that instead of:
 version(SOMEVERSION) {} else { foo(); }
 Same thing with debug.


Aug 29 2003
parent "Matthew Wilson" <matthew stlsoft.org> writes:
"Vathix" <vathix dprogramming.com> wrote in message
news:binkfk$1t7m$1 digitaldaemon.com...
 Interesting, although I think it might be better using && and ||

Fair point
 "Matthew Wilson" <matthew stlsoft.org> wrote in message
 news:bink34$1sqv$1 digitaldaemon.com...
 Yes. Am surprised we cannot.

 We should also be allowed to write

 version (Onething, Another, AndMore)
 {
 }
 else version (Different, Weirder)
 {
 }
 else
 {
 }

 Though I do not know whether we can or can't. Enlightenment needed ...


 "Vathix" <vathix dprogramming.com> wrote in message
 news:biknge$em4$1 digitaldaemon.com...
 If I do this
 version(!SOMEVERSION) { foo(); }
 the compiler has error:  identifier or integer expected, not !
 shouldn't we be able to do that instead of:
 version(SOMEVERSION) {} else { foo(); }
 Same thing with debug.



Aug 29 2003
prev sibling next sibling parent reply "Walter" <walter digitalmars.com> writes:
"Vathix" <vathix dprogramming.com> wrote in message
news:biknge$em4$1 digitaldaemon.com...
 If I do this
 version(!SOMEVERSION) { foo(); }
 the compiler has error:  identifier or integer expected, not !
 shouldn't we be able to do that instead of:
 version(SOMEVERSION) {} else { foo(); }
 Same thing with debug.

It's a good question. What I was trying to do was avoid the C #ifdef mess, where it's nearly always the case that the layers of #if A && B && !C || D make little sense as separate versions, as it was built by layering of incomplete ideas. The idea is to decide exactly what of several versions are to be built, and build that one, not a mix of incomplete versions.
Sep 05 2003
parent "Sean L. Palmer" <palmer.sean verizon.net> writes:
You can't save people from themselves.  ;)

Sean

"Walter" <walter digitalmars.com> wrote in message
news:bjb69g$2pks$1 digitaldaemon.com...
 "Vathix" <vathix dprogramming.com> wrote in message
 news:biknge$em4$1 digitaldaemon.com...
 If I do this
 version(!SOMEVERSION) { foo(); }
 the compiler has error:  identifier or integer expected, not !
 shouldn't we be able to do that instead of:
 version(SOMEVERSION) {} else { foo(); }
 Same thing with debug.

It's a good question. What I was trying to do was avoid the C #ifdef mess, where it's nearly always the case that the layers of #if A && B && !C || D make little sense as separate versions, as it was built by layering of incomplete ideas. The idea is to decide exactly what of several versions

 to be built, and build that one, not a mix of incomplete versions.

Sep 06 2003
prev sibling parent reply "Vathix" <vathix dprogramming.com> writes:
How about allowing debug by itself without parentheses so the code will be
included if any type of debug is on, like assert.

debug foo();

It looks like debug(0) does the trick but I don't think it's a standard.
Sep 06 2003
parent reply "Walter" <walter digitalmars.com> writes:
"Vathix" <vathix dprogramming.com> wrote in message
news:bjdc8h$2ush$1 digitaldaemon.com...
 How about allowing debug by itself without parentheses so the code will be
 included if any type of debug is on, like assert.

 debug foo();

 It looks like debug(0) does the trick but I don't think it's a standard.

The trouble is the ambiguity in the grammar to support both debug (0) expression and debug (expression).
Sep 09 2003
parent "Vathix" <vathix dprogramming.com> writes:
"Walter" <walter digitalmars.com> wrote in message
news:bjmflf$1184$2 digitaldaemon.com...
 "Vathix" <vathix dprogramming.com> wrote in message
 news:bjdc8h$2ush$1 digitaldaemon.com...
 How about allowing debug by itself without parentheses so the code will


 included if any type of debug is on, like assert.

 debug foo();

 It looks like debug(0) does the trick but I don't think it's a standard.

The trouble is the ambiguity in the grammar to support both debug (0) expression and debug (expression).

That's true, sorry. I'm fine with using debug(0)
Sep 10 2003