D - Bring back #define
- Matthew Wilson (22/22) Oct 10 2003 version(Windows)
- Daniel Yokomiso (32/54) Oct 10 2003 maintainability,
- Matthew Wilson (8/67) Oct 10 2003 Yeah, that was not the best example. But that doesn't detract from the
- Jan-Eric Duden (9/88) Oct 10 2003 I guess we need to get rid of our old "macro" habbits and rethink. :)
- Lars Ivar Igesund (8/10) Oct 10 2003 Converting header files to D. If they are large and need different
- Walter (3/12) Oct 10 2003 That is a problem I need to address.
- Walter (14/19) Oct 11 2003 How about this:
- Lars Ivar Igesund (4/23) Oct 11 2003 Looks ok to me. I'll test it some other day.
- shinichiro.h (16/35) Oct 12 2003 version (C) {
- Matthew Wilson (45/136) Oct 10 2003 No, but consider this, latest, one:
- Walter (18/157) Oct 11 2003 You could also write:
- Matthew Wilson (14/182) Oct 11 2003 No! On operating systems that do not have a drive, it is absolutely bogu...
- Walter (9/15) Oct 13 2003 that
- Matthew Wilson (12/31) Oct 13 2003 bogus
- The Lone Haranguer (3/4) Oct 13 2003 Ah, so D is just an experimental language, I see.
- Sean L. Palmer (4/10) Oct 14 2003 I think we just wish it was an experimental language. ;)
- Carlos Santander B. (3/3) Oct 12 2003 ---
-
Carlos Santander B.
(24/24)
Oct 12 2003
"Jan-Eric Duden"
wrote in message - Nicolas Repiquet (17/24) Oct 10 2003 maintainability,
- Hauke Duden (5/21) Oct 10 2003 I like that! It is still not as powerful as #ifdefs were, but it adds a
- Sean L. Palmer (11/32) Oct 10 2003 I second this request.
- Carlos Santander B. (3/3) Oct 12 2003 ---
-
Carlos Santander B.
(20/20)
Oct 12 2003
"Nicolas Repiquet"
wrote in message - Walter (7/20) Oct 13 2003 like
- J C Calvarese (12/30) Oct 13 2003 Here's an idea. We could retain the version() syntax at the statement
- Charles Sanders (8/38) Oct 13 2003 I really hope #define's not brought back, the main argument ive seens is
-
Matthew Wilson
(23/25)
Oct 13 2003
- The Lone Haranguer (6/31) Oct 14 2003 As has been said here before -- you can pass whatever file you want thro...
- Sean L. Palmer (7/30) Oct 14 2003 I have my doubts too, but there have been times in C++ where I wished I
version(Windows) { recls_assert(0 == strcmp(path + 2, pathCheck)); if(0 != strcmp(path + 2, pathCheck)) } <== HERE else { recls_assert(0 == strcmp(path, pathCheck)); if(0 != strcmp(path, pathCheck)) } { fprintf(stderr, "Path is different from path components\n\tpath: %.*s\n\tparts: %.*s\n\n", path, pathCheck); abort(); } This does not compile. Understandably, the compiler doesn't like the brace indicated. What are my options? Do I have to include the body of the if statement twice? That doesn't help maintainability, does it? I think version should either use a different brace, or should use a different format altogether. Otherwise we'll be decreasing maintainability, rather than increasing it. Harummpphh!
Oct 10 2003
"Matthew Wilson" <matthew stlsoft.org> escreveu na mensagem news:bm60qd$30eh$1 digitaldaemon.com...version(Windows) { recls_assert(0 == strcmp(path + 2, pathCheck)); if(0 != strcmp(path + 2, pathCheck)) } <== HERE else { recls_assert(0 == strcmp(path, pathCheck)); if(0 != strcmp(path, pathCheck)) } { fprintf(stderr, "Path is different from path components\n\tpath: %.*s\n\tparts: %.*s\n\n", path, pathCheck); abort(); } This does not compile. Understandably, the compiler doesn't like the brace indicated. What are my options? Do I have to include the body of the if statement twice? That doesn't help maintainability, does it? I think version should either use a different brace, or should use a different format altogether. Otherwise we'll be decreasingmaintainability,rather than increasing it. Harummpphh!Why don't you just write: path2 = path; version(Windows) { path2 = path2 + 2; } recls_assert(0 == strcmp(path2, pathCheck)); if(0 != strcmp(path2, pathCheck)) { fprintf(stderr, "Path is different from path components\n\tpath: %.*s\n\tparts: %.*s\n\n", path, pathCheck); abort(); } It'll remove the duplicated code and do what it's supposed to do. When I saw your example the first thing in my head was "why the code is duplicated, there must be another difference besides the '+ 2'." so I read the code carefully and discovered it was ok. If I was the maintainance programmer I would question that. IME it's better to reduce the differences to the absolute minimum, so it'll be clear what must be equal and what must be different. Best regards, Daniel Yokomiso. "The difference between me and the other surrealists is that I'm a surrealist." - Dali --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.524 / Virus Database: 321 - Release Date: 7/10/2003
Oct 10 2003
Yeah, that was not the best example. But that doesn't detract from the general thrust of my argument. If the version-dependent code is not cleanly outside a { } scope, then it breaks. Which sucks, and is unnecessarily restrictive "Daniel Yokomiso" <daniel_yokomiso yahoo.com.br> wrote in message news:bm62lk$18a$1 digitaldaemon.com..."Matthew Wilson" <matthew stlsoft.org> escreveu na mensagem news:bm60qd$30eh$1 digitaldaemon.com...braceversion(Windows) { recls_assert(0 == strcmp(path + 2, pathCheck)); if(0 != strcmp(path + 2, pathCheck)) } <== HERE else { recls_assert(0 == strcmp(path, pathCheck)); if(0 != strcmp(path, pathCheck)) } { fprintf(stderr, "Path is different from path components\n\tpath: %.*s\n\tparts: %.*s\n\n", path, pathCheck); abort(); } This does not compile. Understandably, the compiler doesn't like thesawindicated. What are my options? Do I have to include the body of the if statement twice? That doesn't help maintainability, does it? I think version should either use a different brace, or should use a different format altogether. Otherwise we'll be decreasingmaintainability,rather than increasing it. Harummpphh!Why don't you just write: path2 = path; version(Windows) { path2 = path2 + 2; } recls_assert(0 == strcmp(path2, pathCheck)); if(0 != strcmp(path2, pathCheck)) { fprintf(stderr, "Path is different from path components\n\tpath: %.*s\n\tparts: %.*s\n\n", path, pathCheck); abort(); } It'll remove the duplicated code and do what it's supposed to do. When Iyour example the first thing in my head was "why the code is duplicated, there must be another difference besides the '+ 2'." so I read the code carefully and discovered it was ok. If I was the maintainance programmer I would question that. IME it's better to reduce the differences to the absolute minimum, so it'll be clear what must be equal and what must be different. Best regards, Daniel Yokomiso. "The difference between me and the other surrealists is that I'm a surrealist." - Dali --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.524 / Virus Database: 321 - Release Date: 7/10/2003
Oct 10 2003
I guess we need to get rid of our old "macro" habbits and rethink. :) Or do you have a problem where version won't work at all? -- Jan-Eric Duden "Matthew Wilson" <matthew stlsoft.org> wrote in message news:bm64m2$3ue$1 digitaldaemon.com...Yeah, that was not the best example. But that doesn't detract from the general thrust of my argument. If the version-dependent code is notcleanlyoutside a { } scope, then it breaks. Which sucks, and is unnecessarily restrictive "Daniel Yokomiso" <daniel_yokomiso yahoo.com.br> wrote in message news:bm62lk$18a$1 digitaldaemon.com...if"Matthew Wilson" <matthew stlsoft.org> escreveu na mensagem news:bm60qd$30eh$1 digitaldaemon.com...braceversion(Windows) { recls_assert(0 == strcmp(path + 2, pathCheck)); if(0 != strcmp(path + 2, pathCheck)) } <== HERE else { recls_assert(0 == strcmp(path, pathCheck)); if(0 != strcmp(path, pathCheck)) } { fprintf(stderr, "Path is different from path components\n\tpath: %.*s\n\tparts: %.*s\n\n", path, pathCheck); abort(); } This does not compile. Understandably, the compiler doesn't like theindicated. What are my options? Do I have to include the body of theIsawstatement twice? That doesn't help maintainability, does it? I think version should either use a different brace, or should use a different format altogether. Otherwise we'll be decreasingmaintainability,rather than increasing it. Harummpphh!Why don't you just write: path2 = path; version(Windows) { path2 = path2 + 2; } recls_assert(0 == strcmp(path2, pathCheck)); if(0 != strcmp(path2, pathCheck)) { fprintf(stderr, "Path is different from path components\n\tpath: %.*s\n\tparts: %.*s\n\n", path, pathCheck); abort(); } It'll remove the duplicated code and do what it's supposed to do. When Iyour example the first thing in my head was "why the code is duplicated, there must be another difference besides the '+ 2'." so I read the code carefully and discovered it was ok. If I was the maintainance programmerwould question that. IME it's better to reduce the differences to the absolute minimum, so it'll be clear what must be equal and what must be different. Best regards, Daniel Yokomiso. "The difference between me and the other surrealists is that I'm a surrealist." - Dali --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.524 / Virus Database: 321 - Release Date: 7/10/2003
Oct 10 2003
"Jan-Eric Duden" <jeduden whisset.com> wrote in message news:bm65lf$58d$1 digitaldaemon.com...I guess we need to get rid of our old "macro" habbits and rethink. :) Or do you have a problem where version won't work at all?Converting header files to D. If they are large and need different calling conventions on different platforms (like OpenGL), you need to write all the declarations twice. (Unless Walter make it possible to alias the calling conventions. Then I could put just the alias in a version statement.) Lars Ivar Igesund
Oct 10 2003
"Lars Ivar Igesund" <larsivi stud.ntnu.no> wrote in message news:bm6lp2$qnl$1 digitaldaemon.com..."Jan-Eric Duden" <jeduden whisset.com> wrote in message news:bm65lf$58d$1 digitaldaemon.com...That is a problem I need to address.I guess we need to get rid of our old "macro" habbits and rethink. :) Or do you have a problem where version won't work at all?Converting header files to D. If they are large and need different calling conventions on different platforms (like OpenGL), you need to write all the declarations twice. (Unless Walter make it possible to alias the calling conventions. Then I could put just the alias in a version statement.)
Oct 10 2003
"Lars Ivar Igesund" <larsivi stud.ntnu.no> wrote in message news:bm6lp2$qnl$1 digitaldaemon.com...Converting header files to D. If they are large and need different calling conventions on different platforms (like OpenGL), you need to write all the declarations twice. (Unless Walter make it possible to alias the calling conventions. Then I could put just the alias in a version statement.)How about this: version (Foo) { extern (C): } version (Bar) { extern (Windows): } void abc(); void def(); ...
Oct 11 2003
"Walter" <walter digitalmars.com> wrote in message news:bm9ree$2468$2 digitaldaemon.com..."Lars Ivar Igesund" <larsivi stud.ntnu.no> wrote in message news:bm6lp2$qnl$1 digitaldaemon.com...Looks ok to me. I'll test it some other day. Lars Ivar IgesundConverting header files to D. If they are large and need different calling conventions on different platforms (like OpenGL), you need to write all the declarations twice. (Unless Walter make it possible to alias the calling conventions. Then I could put just the alias in a version statement.)How about this: version (Foo) { extern (C): } version (Bar) { extern (Windows): } void abc(); void def(); ...
Oct 11 2003
How about this: version (Foo) { extern (C): } version (Bar) { extern (Windows): } void abc(); void def(); ...Does it work good? I performed a simple following experiment:cat version.dversion (C) { extern(C): void c_func() {} } // I think "extern (C)" is ended. void maybe_not_c_func() {}dmd -c version.d nm version.o00000000 ? _D7version16maybe_not_c_funcFZv 00000000 t gcc2_compiled.dmd -c -version=C version.d nm version.o00000000 ? _D7version16maybe_not_c_funcFZv 00000000 ? c_func 00000000 t gcc2_compiled. I hope the last maybe_not_c_func has C-linkage, but it has D-linkage in my environment (Linux, DMD-0.73). ------------------ shinichiro.h s31552 mail.ecc.u-tokyo.ac.jp
Oct 12 2003
No, but consider this, latest, one: char[] composite_path1 = null version(Windows) { ~ Drive() } // version(Windows) ~ Directory() ~ File() ; No-one can tell me that this would be better written as version(Windows) { char[] composite_path1 = null ~ Drive() ~ Directory() ~ File() ; } else { char[] composite_path1 = null ~ Directory() ~ File() ; } // version(Windows) Now I have to write it as char[] composite_path1 = null; version(Windows) { composite_path1 ~= Drive(); } // version(Windows) composite_path1 ~= Directory(); composite_path1 ~= File(); While this may be fine in the current context - inside an invariant - it would be undesirable in release code. Maybe repeated ~= are less efficient that a single ~, as they are in some other languages. Even if they're not, I disagree that this repression of expressiveness is a good thing, just because it is easier to implement the language feature in this way. "Jan-Eric Duden" <jeduden whisset.com> wrote in message news:bm65lf$58d$1 digitaldaemon.com...I guess we need to get rid of our old "macro" habbits and rethink. :) Or do you have a problem where version won't work at all? -- Jan-Eric Duden "Matthew Wilson" <matthew stlsoft.org> wrote in message news:bm64m2$3ue$1 digitaldaemon.com...IYeah, that was not the best example. But that doesn't detract from the general thrust of my argument. If the version-dependent code is notcleanlyoutside a { } scope, then it breaks. Which sucks, and is unnecessarily restrictive "Daniel Yokomiso" <daniel_yokomiso yahoo.com.br> wrote in message news:bm62lk$18a$1 digitaldaemon.com...if"Matthew Wilson" <matthew stlsoft.org> escreveu na mensagem news:bm60qd$30eh$1 digitaldaemon.com...braceversion(Windows) { recls_assert(0 == strcmp(path + 2, pathCheck)); if(0 != strcmp(path + 2, pathCheck)) } <== HERE else { recls_assert(0 == strcmp(path, pathCheck)); if(0 != strcmp(path, pathCheck)) } { fprintf(stderr, "Path is different from path components\n\tpath: %.*s\n\tparts: %.*s\n\n", path, pathCheck); abort(); } This does not compile. Understandably, the compiler doesn't like theindicated. What are my options? Do I have to include the body of thestatement twice? That doesn't help maintainability, does it? I think version should either use a different brace, or should use a different format altogether. Otherwise we'll be decreasingmaintainability,rather than increasing it. Harummpphh!Why don't you just write: path2 = path; version(Windows) { path2 = path2 + 2; } recls_assert(0 == strcmp(path2, pathCheck)); if(0 != strcmp(path2, pathCheck)) { fprintf(stderr, "Path is different from path components\n\tpath: %.*s\n\tparts: %.*s\n\n", path, pathCheck); abort(); } It'll remove the duplicated code and do what it's supposed to do. Whend,sawyour example the first thing in my head was "why the code is duplicatecodethere must be another difference besides the '+ 2'." so I read theprogrammercarefully and discovered it was ok. If I was the maintainanceIbewould question that. IME it's better to reduce the differences to the absolute minimum, so it'll be clear what must be equal and what mustdifferent. Best regards, Daniel Yokomiso. "The difference between me and the other surrealists is that I'm a surrealist." - Dali --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.524 / Virus Database: 321 - Release Date: 7/10/2003
Oct 10 2003
You could also write: version (Windows) { char[] Drive(); } else { char[] Drive() { return ""; } } "Matthew Wilson" <matthew stlsoft.org> wrote in message news:bm7k39$244a$1 digitaldaemon.com...No, but consider this, latest, one: char[] composite_path1 = null version(Windows) { ~ Drive() } // version(Windows) ~ Directory() ~ File() ; No-one can tell me that this would be better written as version(Windows) { char[] composite_path1 = null ~ Drive() ~ Directory() ~ File() ; } else { char[] composite_path1 = null ~ Directory() ~ File() ; } // version(Windows) Now I have to write it as char[] composite_path1 = null; version(Windows) { composite_path1 ~= Drive(); } // version(Windows) composite_path1 ~= Directory(); composite_path1 ~= File(); While this may be fine in the current context - inside an invariant - it would be undesirable in release code. Maybe repeated ~= are less efficient that a single ~, as they are in some other languages. Even if they're not,Idisagree that this repression of expressiveness is a good thing, just because it is easier to implement the language feature in this way. "Jan-Eric Duden" <jeduden whisset.com> wrote in message news:bm65lf$58d$1 digitaldaemon.com...theI guess we need to get rid of our old "macro" habbits and rethink. :) Or do you have a problem where version won't work at all? -- Jan-Eric Duden "Matthew Wilson" <matthew stlsoft.org> wrote in message news:bm64m2$3ue$1 digitaldaemon.com...Yeah, that was not the best example. But that doesn't detract from the general thrust of my argument. If the version-dependent code is notcleanlyoutside a { } scope, then it breaks. Which sucks, and is unnecessarily restrictive "Daniel Yokomiso" <daniel_yokomiso yahoo.com.br> wrote in message news:bm62lk$18a$1 digitaldaemon.com..."Matthew Wilson" <matthew stlsoft.org> escreveu na mensagem news:bm60qd$30eh$1 digitaldaemon.com...version(Windows) { recls_assert(0 == strcmp(path + 2, pathCheck)); if(0 != strcmp(path + 2, pathCheck)) } <== HERE else { recls_assert(0 == strcmp(path, pathCheck)); if(0 != strcmp(path, pathCheck)) } { fprintf(stderr, "Path is different from path components\n\tpath: %.*s\n\tparts: %.*s\n\n", path, pathCheck); abort(); } This does not compile. Understandably, the compiler doesn't likethebraceindicated. What are my options? Do I have to include the body ofaifstatement twice? That doesn't help maintainability, does it? I think version should either use a different brace, or should useWhendifferent format altogether. Otherwise we'll be decreasingmaintainability,rather than increasing it. Harummpphh!Why don't you just write: path2 = path; version(Windows) { path2 = path2 + 2; } recls_assert(0 == strcmp(path2, pathCheck)); if(0 != strcmp(path2, pathCheck)) { fprintf(stderr, "Path is different from path components\n\tpath: %.*s\n\tparts: %.*s\n\n", path, pathCheck); abort(); } It'll remove the duplicated code and do what it's supposed to do.Iduplicatesawyour example the first thing in my head was "why the code isd,thecodethere must be another difference besides the '+ 2'." so I read theprogrammercarefully and discovered it was ok. If I was the maintainanceIwould question that. IME it's better to reduce the differences tobeabsolute minimum, so it'll be clear what must be equal and what mustdifferent. Best regards, Daniel Yokomiso. "The difference between me and the other surrealists is that I'm a surrealist." - Dali --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.524 / Virus Database: 321 - Release Date: 7/10/2003
Oct 11 2003
No! On operating systems that do not have a drive, it is absolutely bogus and evil to give them a "null" drive. (btw, Drive returns a char, not a string) Anyway, that's just the specific case. This will come up time and time again, probably almost as much as #define is used, so we need something that works. "Walter" <walter digitalmars.com> wrote in message news:bm9ref$2468$3 digitaldaemon.com...You could also write: version (Windows) { char[] Drive(); } else { char[] Drive() { return ""; } } "Matthew Wilson" <matthew stlsoft.org> wrote in message news:bm7k39$244a$1 digitaldaemon.com...efficientNo, but consider this, latest, one: char[] composite_path1 = null version(Windows) { ~ Drive() } // version(Windows) ~ Directory() ~ File() ; No-one can tell me that this would be better written as version(Windows) { char[] composite_path1 = null ~ Drive() ~ Directory() ~ File() ; } else { char[] composite_path1 = null ~ Directory() ~ File() ; } // version(Windows) Now I have to write it as char[] composite_path1 = null; version(Windows) { composite_path1 ~= Drive(); } // version(Windows) composite_path1 ~= Directory(); composite_path1 ~= File(); While this may be fine in the current context - inside an invariant - it would be undesirable in release code. Maybe repeated ~= are lessnot,that a single ~, as they are in some other languages. Even if they'reIthedisagree that this repression of expressiveness is a good thing, just because it is easier to implement the language feature in this way. "Jan-Eric Duden" <jeduden whisset.com> wrote in message news:bm65lf$58d$1 digitaldaemon.com...I guess we need to get rid of our old "macro" habbits and rethink. :) Or do you have a problem where version won't work at all? -- Jan-Eric Duden "Matthew Wilson" <matthew stlsoft.org> wrote in message news:bm64m2$3ue$1 digitaldaemon.com...Yeah, that was not the best example. But that doesn't detract fromunnecessarilygeneral thrust of my argument. If the version-dependent code is notcleanlyoutside a { } scope, then it breaks. Which sucks, and isusetherestrictive "Daniel Yokomiso" <daniel_yokomiso yahoo.com.br> wrote in message news:bm62lk$18a$1 digitaldaemon.com..."Matthew Wilson" <matthew stlsoft.org> escreveu na mensagem news:bm60qd$30eh$1 digitaldaemon.com...version(Windows) { recls_assert(0 == strcmp(path + 2, pathCheck)); if(0 != strcmp(path + 2, pathCheck)) } <== HERE else { recls_assert(0 == strcmp(path, pathCheck)); if(0 != strcmp(path, pathCheck)) } { fprintf(stderr, "Path is different from path components\n\tpath: %.*s\n\tparts: %.*s\n\n", path, pathCheck); abort(); } This does not compile. Understandably, the compiler doesn't likethebraceindicated. What are my options? Do I have to include the body ofifstatement twice? That doesn't help maintainability, does it? I think version should either use a different brace, or shouldamustWhendifferent format altogether. Otherwise we'll be decreasingmaintainability,rather than increasing it. Harummpphh!Why don't you just write: path2 = path; version(Windows) { path2 = path2 + 2; } recls_assert(0 == strcmp(path2, pathCheck)); if(0 != strcmp(path2, pathCheck)) { fprintf(stderr, "Path is different from path components\n\tpath: %.*s\n\tparts: %.*s\n\n", path, pathCheck); abort(); } It'll remove the duplicated code and do what it's supposed to do.Iduplicatesawyour example the first thing in my head was "why the code isd,thecodethere must be another difference besides the '+ 2'." so I read theprogrammercarefully and discovered it was ok. If I was the maintainanceIwould question that. IME it's better to reduce the differences toabsolute minimum, so it'll be clear what must be equal and whatbedifferent. Best regards, Daniel Yokomiso. "The difference between me and the other surrealists is that I'm a surrealist." - Dali --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.524 / Virus Database: 321 - Release Date: 7/10/2003
Oct 11 2003
"Matthew Wilson" <matthew stlsoft.org> wrote in message news:bm9sds$25dr$1 digitaldaemon.com...No! On operating systems that do not have a drive, it is absolutely bogus and evil to give them a "null" drive. (btw, Drive returns a char, not a string) Anyway, that's just the specific case. This will come up time and time again, probably almost as much as #define is used, so we need somethingthatworks.I know what you mean. Where I'm coming from is that I have dealt a lot with code that had lots of deeply embedded #ifdef's in it that are pushed down to the lowest level possible. I eventually came to the conclusion that #ifdef's should be at a higher level (makes the code much easier to read). Perhaps it's at too high a level with version, but I want to give it a try and see how it goes.
Oct 13 2003
"Walter" <walter digitalmars.com> wrote in message news:bmfk7k$lkg$1 digitaldaemon.com..."Matthew Wilson" <matthew stlsoft.org> wrote in message news:bm9sds$25dr$1 digitaldaemon.com...bogusNo! On operating systems that do not have a drive, it is absolutelywithand evil to give them a "null" drive. (btw, Drive returns a char, not a string) Anyway, that's just the specific case. This will come up time and time again, probably almost as much as #define is used, so we need somethingthatworks.I know what you mean. Where I'm coming from is that I have dealt a lotcode that had lots of deeply embedded #ifdef's in it that are pushed downtothe lowest level possible.An enormous amount is, and for ease of porting it would be good to facilitate what is there. To have to seriously rework logic at the same time as porting is going to reduce the likely success significantly. (Which I know I don't have to tell you, but am feeling in a didactic mood, so what the hell!)I eventually came to the conclusion that #ifdef's should be at a higher level (makes the code much easier to read).Indeed they should. However, most are not.Perhaps it's at too high a level with version, but I want to give it a try and see how it goes.I've tried. We've seen. Case proven, m'lod
Oct 13 2003
In article <bmfk7k$lkg$1 digitaldaemon.com>, Walter says... but I want to give it a try and seehow it goes.Ah, so D is just an experimental language, I see.
Oct 13 2003
I think we just wish it was an experimental language. ;) Sean "The Lone Haranguer" <The_member pathlink.com> wrote in message news:bmfnf0$pkg$1 digitaldaemon.com...In article <bmfk7k$lkg$1 digitaldaemon.com>, Walter says... but I want to give it a try and seehow it goes.Ah, so D is just an experimental language, I see.
Oct 14 2003
--- Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.525 / Virus Database: 322 - Release Date: 2003-10-09
Oct 12 2003
"Jan-Eric Duden" <jeduden whisset.com> wrote in message news:bm65lf$58d$1 digitaldaemon.com... | I guess we need to get rid of our old "macro" habbits and rethink. :) | Or do you have a problem where version won't work at all? | | -- | Jan-Eric Duden (Sorry for that previous one) I believe that's something that happens when we all go from one language to another. ————————————————————————— Carlos Santander "Jan-Eric Duden" <jeduden whisset.com> wrote in message news:bm65lf$58d$1 digitaldaemon.com... | I guess we need to get rid of our old "macro" habbits and rethink. :) | Or do you have a problem where version won't work at all? | | -- | Jan-Eric Duden (Sorry for that previous one) I believe that's something that happens when we all go from one language to another. ————————————————————————— Carlos Santander
Oct 12 2003
"Matthew Wilson" <matthew stlsoft.org> a écrit dans le message news: bm60qd$30eh$1 digitaldaemon.com...This does not compile. Understandably, the compiler doesn't like the brace indicated. What are my options? Do I have to include the body of the if statement twice? That doesn't help maintainability, does it? I think version should either use a different brace, or should use a different format altogether. Otherwise we'll be decreasingmaintainability,rather than increasing it. Harummpphh!Using different brace brings us back to the awful c-like preprocessor. Versioning is part of D's syntax, and that's great. But I agree that some versioning features are missing. I'm thinking about a version(...) expression returning a constant boolean. So you can solve your problem like that : recls_assert(0 == strcmp(path + ( version(Windows) ? 0 : 2 ), pathCheck)); if(0 != strcmp(path + ( version(Windows) ? 0 : 2 ), pathCheck)) { fprintf(stderr, "Path is different from path ..." ); abort(); } Constant folding optimization will (probably ?) make it as efficient as old #if syntax. -- Nicolas Repiquet
Oct 10 2003
Nicolas Repiquet wrote:Using different brace brings us back to the awful c-like preprocessor. Versioning is part of D's syntax, and that's great. But I agree that some versioning features are missing. I'm thinking about a version(...) expression returning a constant boolean. So you can solve your problem like that : recls_assert(0 == strcmp(path + ( version(Windows) ? 0 : 2 ), pathCheck)); if(0 != strcmp(path + ( version(Windows) ? 0 : 2 ), pathCheck)) { fprintf(stderr, "Path is different from path ..." ); abort(); } Constant folding optimization will (probably ?) make it as efficient as old #if syntax.I like that! It is still not as powerful as #ifdefs were, but it adds a lot of flexibility for situations where the difference between versions are only parametrical (i.e. same code with different values). Hauke
Oct 10 2003
I second this request. version(x) { } should only be legal where a statement or declaration is legal. version(x) should be legal anywhere an expression is legal. Sean "Hauke Duden" <H.NS.Duden gmx.net> wrote in message news:bm6l14$php$1 digitaldaemon.com...Nicolas Repiquet wrote:someUsing different brace brings us back to the awful c-like preprocessor. Versioning is part of D's syntax, and that's great. But I agree thatlikeversioning features are missing. I'm thinking about a version(...) expression returning a constant boolean. So you can solve your problempathCheck));that : recls_assert(0 == strcmp(path + ( version(Windows) ? 0 : 2 ),oldif(0 != strcmp(path + ( version(Windows) ? 0 : 2 ), pathCheck)) { fprintf(stderr, "Path is different from path ..." ); abort(); } Constant folding optimization will (probably ?) make it as efficient as#if syntax.I like that! It is still not as powerful as #ifdefs were, but it adds a lot of flexibility for situations where the difference between versions are only parametrical (i.e. same code with different values). Hauke
Oct 10 2003
--- Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.525 / Virus Database: 322 - Release Date: 2003-10-09
Oct 12 2003
"Nicolas Repiquet" <deadcow-remove-this free.fr> wrote in message news:bm66gs$68l$1 digitaldaemon.com... | | | recls_assert(0 == strcmp(path + ( version(Windows) ? 0 : 2 ), pathCheck)); | if(0 != strcmp(path + ( version(Windows) ? 0 : 2 ), pathCheck)) | { | fprintf(stderr, "Path is different from path ..." ); | abort(); | } | | (Sorry for that one too) I also like that. ————————————————————————— Carlos Santander --- Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.525 / Virus Database: 322 - Release Date: 2003-10-09
Oct 12 2003
"Nicolas Repiquet" <deadcow-remove-this free.fr> wrote in message news:bm66gs$68l$1 digitaldaemon.com...Using different brace brings us back to the awful c-like preprocessor. Versioning is part of D's syntax, and that's great. But I agree that some versioning features are missing. I'm thinking about a version(...) expression returning a constant boolean. So you can solve your problemlikethat : recls_assert(0 == strcmp(path + ( version(Windows) ? 0 : 2 ),pathCheck));if(0 != strcmp(path + ( version(Windows) ? 0 : 2 ), pathCheck)) { fprintf(stderr, "Path is different from path ..." ); abort(); } Constant folding optimization will (probably ?) make it as efficient asold#if syntax.I'm probably alone in my opinion on this <g>, but I like to see conditional compilation at a higher level than the expression level.
Oct 13 2003
Walter wrote:"Nicolas Repiquet" <deadcow-remove-this free.fr> wrote in message news:bm66gs$68l$1 digitaldaemon.com...Here's an idea. We could retain the version() syntax at the statement level and add a keyword called "define" maybe for the expression level. Something that I think could really hold back the power of version() is the inability to do even simple booleans (limited to version specifiers) or specify multiple versions at the same time, such as version(NORWEGIAN || SPANISH) version(NORWEGIAN, SPANISH) version(NORWEGIAN && !UNITED_STATES) etc. #define is messy, but it is *very* flexible. (Not that I know C or C++.) Justinif(0 != strcmp(path + ( version(Windows) ? 0 : 2 ), pathCheck)) { fprintf(stderr, "Path is different from path ..." ); abort(); } Constant folding optimization will (probably ?) make it as efficient asold#if syntax.I'm probably alone in my opinion on this <g>, but I like to see conditional compilation at a higher level than the expression level.
Oct 13 2003
I really hope #define's not brought back, the main argument ive seens is that of porting, which seems a sort of 'backward-compatility' issue. I understand the porting is important, but in my opionon not enough to change the language. I would like to see JC's || and && implemented though. C "J C Calvarese" <jcc7 cox.net> wrote in message news:bmfn3r$p81$1 digitaldaemon.com...Walter wrote:conditional"Nicolas Repiquet" <deadcow-remove-this free.fr> wrote in message news:bm66gs$68l$1 digitaldaemon.com...if(0 != strcmp(path + ( version(Windows) ? 0 : 2 ), pathCheck)) { fprintf(stderr, "Path is different from path ..." ); abort(); } Constant folding optimization will (probably ?) make it as efficient asold#if syntax.I'm probably alone in my opinion on this <g>, but I like to seecompilation at a higher level than the expression level.Here's an idea. We could retain the version() syntax at the statement level and add a keyword called "define" maybe for the expression level. Something that I think could really hold back the power of version() is the inability to do even simple booleans (limited to version specifiers) or specify multiple versions at the same time, such as version(NORWEGIAN || SPANISH) version(NORWEGIAN, SPANISH) version(NORWEGIAN && !UNITED_STATES) etc. #define is messy, but it is *very* flexible. (Not that I know C or C++.) Justin
Oct 13 2003
"Charles Sanders" <sanders-consulting comcast.net> wrote in message news:bmfne8$pj4$1 digitaldaemon.com...I really hope #define's not brought back, the main argument ive seens is that of porting, which seems a sort of 'backward-compatility' issue.<sarcastic:friendly> So you want D to only ever run on one version of one flavour of one platform? Shall we say Windows 2000 (NT family) on 686? </sarcastic:friendly> This issue is not just about porting from another language to D. That's just the latest thing that's given me cause to complain, i.e. when porting C++ code into the recls D mapping. But this has caused much hassle in other D code, in the registry library, and I complained about it then. To take my sarcastic comment seriously, it is quite true that if we do not provide sophisticated versioning within the language (and the current method is anything but), then we're going to have to stick to one platform, or we'll be jumping through hoops just as large (albeit less secretive) as are required in C and C++ with the preprocessor. And let me make a "stance" observation: I like the C pre-processor, and I believe it, or something like it, should be available in all languages. However, that's not to say I like macros; I don't. Macros stink, and every time I have to use/write one I am much less happy than I am with using goto. (If you look at the STLSoft libs, you'll see plenty of #if discrimination, in order to support so many compilers and platforms, but you'll see very few macros, and I've cried a little tear for each. <g>)
Oct 13 2003
In article <bmfpcs$s87$1 digitaldaemon.com>, Matthew Wilson says..."Charles Sanders" <sanders-consulting comcast.net> wrote in message news:bmfne8$pj4$1 digitaldaemon.com...As has been said here before -- you can pass whatever file you want through the "C preprocessor". It is probably time to stop calling it that anyway and rename it, something like "the ANSI standard text replacement facility" (oh wait, then there can't be pragmas, oh well). As the D docs say; "the preprocessor is a different language from C".I really hope #define's not brought back, the main argument ive seens is that of porting, which seems a sort of 'backward-compatility' issue.<sarcastic:friendly> So you want D to only ever run on one version of one flavour of one platform? Shall we say Windows 2000 (NT family) on 686? </sarcastic:friendly> This issue is not just about porting from another language to D. That's just the latest thing that's given me cause to complain, i.e. when porting C++ code into the recls D mapping. But this has caused much hassle in other D code, in the registry library, and I complained about it then. To take my sarcastic comment seriously, it is quite true that if we do not provide sophisticated versioning within the language (and the current method is anything but), then we're going to have to stick to one platform, or we'll be jumping through hoops just as large (albeit less secretive) as are required in C and C++ with the preprocessor. And let me make a "stance" observation: I like the C pre-processor, and I believe it, or something like it, should be available in all languages. However, that's not to say I like macros; I don't. Macros stink, and every time I have to use/write one I am much less happy than I am with using goto. (If you look at the STLSoft libs, you'll see plenty of #if discrimination, in order to support so many compilers and platforms, but you'll see very few macros, and I've cried a little tear for each. <g>)
Oct 14 2003
I have my doubts too, but there have been times in C++ where I wished I could do it. Sean "Walter" <walter digitalmars.com> wrote in message news:bmfkqg$mbk$1 digitaldaemon.com..."Nicolas Repiquet" <deadcow-remove-this free.fr> wrote in message news:bm66gs$68l$1 digitaldaemon.com...someUsing different brace brings us back to the awful c-like preprocessor. Versioning is part of D's syntax, and that's great. But I agree thatconditionalversioning features are missing. I'm thinking about a version(...) expression returning a constant boolean. So you can solve your problemlikethat : recls_assert(0 == strcmp(path + ( version(Windows) ? 0 : 2 ),pathCheck));if(0 != strcmp(path + ( version(Windows) ? 0 : 2 ), pathCheck)) { fprintf(stderr, "Path is different from path ..." ); abort(); } Constant folding optimization will (probably ?) make it as efficient asold#if syntax.I'm probably alone in my opinion on this <g>, but I like to seecompilation at a higher level than the expression level.
Oct 14 2003