digitalmars.D.announce - DMD 1.039 and 2.023 releases
- Walter Bright (5/5) Jan 06 2009 Faster long divides!
- Bill Baxter (3/4) Jan 06 2009 No progress on "faster long compiles" though?
- Denis Koroskin (5/9) Jan 06 2009 Small statistics on compilation time of my small project:
- Walter Bright (2/4) Jan 06 2009 Bugzilla report, pls!
- Denis Koroskin (2/6) Jan 06 2009 Already done.
- Walter Bright (2/5) Jan 06 2009 Thanks!
- Extrawurst (3/18) Jan 07 2009 Wow this one really sucks. For me this makes nearly every D2 using
- Jarrett Billingsley (4/8) Jan 06 2009 The D2 changelog says that he undid the fix to 2500, which might be
- Walter Bright (2/5) Jan 06 2009 D1 got the same reversion.
- Jarrett Billingsley (3/9) Jan 06 2009 Wee!
- torhu (4/9) Jan 07 2009 1.039 hangs while trying to build my DWT app, just like 1.038 did. It
- Walter Bright (2/5) Jan 07 2009 I need a reproducible example.
- Bill Baxter (4/15) Jan 06 2009 Guess I'll give it a try then.
- Denis Koroskin (4/9) Jan 06 2009 Nice!
- Bill Baxter (3/20) Jan 06 2009 Whoa! I would have believed 1 year. Doesn't seem like 2.
- Denis Koroskin (2/30) Jan 06 2009 It will be a year for D2 in ten days.
- Denis Koroskin (2/37) Jan 06 2009 Ahhhmm.. 2 years as well, sorry for confusion.
- bearophile (9/9) Jan 06 2009 V 1.039 compiles my dlibs fine, but I have not timed the compilation tim...
- Walter Bright (3/11) Jan 06 2009 I changed nothing with the compiler. I just rewrote the runtime long
- Jarrett Billingsley (4/8) Jan 07 2009 Can you say "non sequitur"?
- Bill Baxter (4/11) Jan 06 2009 Rockin'. Compile times seem unchanged wrt DMD 1.037 here too.
- Tom S (8/8) Jan 07 2009 It appears that you've also fixed
- redsea (25/34) Jan 07 2009 I'm happy to see Bugzilla 2518(scope(success) not execuate and RAII vari...
- Walter Bright (3/33) Jan 07 2009 A NonScopeStatement is a statement that, even if it has { }, does not
- Jason House (3/37) Jan 07 2009 I don't think this answers their question. What curly braces mean after ...
- Brad Roberts (5/42) Jan 07 2009 Restating in the form of a question... When would you _ever_ want {...}
- Denis Koroskin (8/50) Jan 07 2009 The only possible example I can think of is a case inside switch:
- BCS (6/9) Jan 07 2009 static if(foo)
- Denis Koroskin (2/11) Jan 07 2009 Yeah, and version(foo) belongs here, too.
- Bill Baxter (10/25) Jan 07 2009 I think I said this before, but I do think it would be nice if there
- Brad Roberts (15/27) Jan 07 2009 That and the version one are good examples.
- Walter Bright (13/21) Jan 07 2009 version (foo)
- Stewart Gordon (12/15) Jan 10 2009 I still don't get it.
- bearophile (14/17) Jan 08 2009 Recently I have shown a possible syntax for express general unsafeties i...
- Bill Baxter (28/44) Jan 08 2009 It just means curly braces. I don't really care what syntax it is,
- bearophile (88/93) Jan 08 2009 *Now* I understand, and I see your point.
- Yigal Chripun (19/107) Jan 16 2009 in C# they use the same syntax as the c pre-processor for conditional
- Bill Baxter (3/46) Jan 16 2009 I kinda like that, actually, but I doubt it'll be very popular around he...
- Daniel Keep (14/41) Jan 16 2009 The '#' has a nice connotation for anyone who's used to C/C++, given
- Denis Koroskin (18/62) Jan 16 2009 Well, syntax could be different:
- bearophile (7/22) Jan 17 2009 A different possibility is to use {# ... #}
- Michel Fortin (14/29) Jan 17 2009 All good reasons, but there is one more:
- Nick Sabalausky (10/36) Jan 17 2009 The only time I've had a problem with any scope/scopeless block issue is...
- Nicolas (26/84) Jan 08 2009 I'd do:
- Bill Baxter (4/88) Jan 08 2009 I'm having trouble resisting the urge to re-indent that code. It
- Nick Sabalausky (3/3) Jan 07 2009 "2527: Alias Template Params Are Always Same Type As First Instantiation...
- Jason House (2/11) Jan 07 2009 It's nice to see the backend uses pure. When will Phobos?
- Andrei Alexandrescu (3/16) Jan 07 2009 Yes. :o)
- Denis Koroskin (2/17) Jan 07 2009 Yes? O_o
Faster long divides! http://www.digitalmars.com/d/1.0/changelog.html http://ftp.digitalmars.com/dmd.1.039.zip http://www.digitalmars.com/d/2.0/changelog.html http://ftp.digitalmars.com/dmd.2.023.zip
Jan 06 2009
2009/1/7 Walter Bright <newshound1 digitalmars.com>:Faster long divides!No progress on "faster long compiles" though? --bb
Jan 06 2009
On Wed, 07 Jan 2009 07:03:27 +0300, Bill Baxter <wbaxter gmail.com> wrote:2009/1/7 Walter Bright <newshound1 digitalmars.com>:Small statistics on compilation time of my small project: DMD2.021 - 16 seconds DMD2.022 - 46 seconds DMD2.023 - 15 seconds (and an Internal error: ..\ztc\cod4.c 357 on one of source code files) :)Faster long divides!No progress on "faster long compiles" though? --bb
Jan 06 2009
Denis Koroskin wrote:(and an Internal error: ..\ztc\cod4.c 357 on one of source code files) :)Bugzilla report, pls!
Jan 06 2009
On Wed, 07 Jan 2009 08:34:10 +0300, Walter Bright <newshound1 digitalmars.com> wrote:Denis Koroskin wrote:Already done.(and an Internal error: ..\ztc\cod4.c 357 on one of source code files) :)Bugzilla report, pls!
Jan 06 2009
Denis Koroskin wrote:Thanks!Bugzilla report, pls!Already done.
Jan 06 2009
Denis Koroskin wrote:On Wed, 07 Jan 2009 07:03:27 +0300, Bill Baxter <wbaxter gmail.com> wrote:Wow this one really sucks. For me this makes nearly every D2 using project unbuildable ;(2009/1/7 Walter Bright <newshound1 digitalmars.com>:Small statistics on compilation time of my small project: DMD2.021 - 16 seconds DMD2.022 - 46 seconds DMD2.023 - 15 seconds (and an Internal error: ..\ztc\cod4.c 357 on one of source code files) :)Faster long divides!No progress on "faster long compiles" though? --bb
Jan 07 2009
On Tue, Jan 6, 2009 at 11:03 PM, Bill Baxter <wbaxter gmail.com> wrote:2009/1/7 Walter Bright <newshound1 digitalmars.com>:The D2 changelog says that he undid the fix to 2500, which might be the cause. But no word on whether it was the cause, or if D1 got the revert as well.Faster long divides!No progress on "faster long compiles" though? --bb
Jan 06 2009
Jarrett Billingsley wrote:The D2 changelog says that he undid the fix to 2500, which might be the cause. But no word on whether it was the cause, or if D1 got the revert as well.D1 got the same reversion.
Jan 06 2009
On Tue, Jan 6, 2009 at 11:51 PM, Walter Bright <newshound1 digitalmars.com> wrote:Jarrett Billingsley wrote:Wee!The D2 changelog says that he undid the fix to 2500, which might be the cause. But no word on whether it was the cause, or if D1 got the revert as well.D1 got the same reversion.
Jan 06 2009
On 07.01.2009 05:51, Walter Bright wrote:Jarrett Billingsley wrote:1.039 hangs while trying to build my DWT app, just like 1.038 did. It just seems to never finish, so I kill it after a while. Don't know if it's related to this issue or not.The D2 changelog says that he undid the fix to 2500, which might be the cause. But no word on whether it was the cause, or if D1 got the revert as well.D1 got the same reversion.
Jan 07 2009
torhu wrote:1.039 hangs while trying to build my DWT app, just like 1.038 did. It just seems to never finish, so I kill it after a while. Don't know if it's related to this issue or not.I need a reproducible example.
Jan 07 2009
On Wed, Jan 7, 2009 at 1:04 PM, Jarrett Billingsley <jarrett.billingsley gmail.com> wrote:On Tue, Jan 6, 2009 at 11:03 PM, Bill Baxter <wbaxter gmail.com> wrote:Guess I'll give it a try then. --bb2009/1/7 Walter Bright <newshound1 digitalmars.com>:The D2 changelog says that he undid the fix to 2500, which might be the cause. But no word on whether it was the cause, or if D1 got the revert as well.Faster long divides!No progress on "faster long compiles" though? --bb
Jan 06 2009
On Wed, 07 Jan 2009 06:53:27 +0300, Walter Bright <newshound1 digitalmars.com> wrote:Faster long divides! http://www.digitalmars.com/d/1.0/changelog.html http://ftp.digitalmars.com/dmd.1.039.zip http://www.digitalmars.com/d/2.0/changelog.html http://ftp.digitalmars.com/dmd.2.023.zipNice! Before you start closing fixed issues, I'd like to ask you add short fix discription wherever possible, because it is sometimes hard to understand what is fixed and how, especially in ambiguous cases. BTW, D1 is 2 years old by now (DMD1.000 was released on January, 2 in 2007). Congratulations!
Jan 06 2009
On Wed, Jan 7, 2009 at 1:09 PM, Denis Koroskin <2korden gmail.com> wrote:On Wed, 07 Jan 2009 06:53:27 +0300, Walter Bright <newshound1 digitalmars.com> wrote:Whoa! I would have believed 1 year. Doesn't seem like 2. --bbFaster long divides! http://www.digitalmars.com/d/1.0/changelog.html http://ftp.digitalmars.com/dmd.1.039.zip http://www.digitalmars.com/d/2.0/changelog.html http://ftp.digitalmars.com/dmd.2.023.zipNice! Before you start closing fixed issues, I'd like to ask you add short fix discription wherever possible, because it is sometimes hard to understand what is fixed and how, especially in ambiguous cases. BTW, D1 is 2 years old by now (DMD1.000 was released on January, 2 in 2007). Congratulations!
Jan 06 2009
On Wed, 07 Jan 2009 07:11:52 +0300, Bill Baxter <wbaxter gmail.com> wrote:On Wed, Jan 7, 2009 at 1:09 PM, Denis Koroskin <2korden gmail.com> wrote:It will be a year for D2 in ten days.On Wed, 07 Jan 2009 06:53:27 +0300, Walter Bright <newshound1 digitalmars.com> wrote:Whoa! I would have believed 1 year. Doesn't seem like 2. --bbFaster long divides! http://www.digitalmars.com/d/1.0/changelog.html http://ftp.digitalmars.com/dmd.1.039.zip http://www.digitalmars.com/d/2.0/changelog.html http://ftp.digitalmars.com/dmd.2.023.zipNice! Before you start closing fixed issues, I'd like to ask you add short fix discription wherever possible, because it is sometimes hard to understand what is fixed and how, especially in ambiguous cases. BTW, D1 is 2 years old by now (DMD1.000 was released on January, 2 in 2007). Congratulations!
Jan 06 2009
On Wed, 07 Jan 2009 07:16:38 +0300, Denis Koroskin <2korden gmail.com> wrote:On Wed, 07 Jan 2009 07:11:52 +0300, Bill Baxter <wbaxter gmail.com> wrote:Ahhhmm.. 2 years as well, sorry for confusion.On Wed, Jan 7, 2009 at 1:09 PM, Denis Koroskin <2korden gmail.com> wrote:It will be a year for D2 in ten days.On Wed, 07 Jan 2009 06:53:27 +0300, Walter Bright <newshound1 digitalmars.com> wrote:Whoa! I would have believed 1 year. Doesn't seem like 2. --bbFaster long divides! http://www.digitalmars.com/d/1.0/changelog.html http://ftp.digitalmars.com/dmd.1.039.zip http://www.digitalmars.com/d/2.0/changelog.html http://ftp.digitalmars.com/dmd.2.023.zipNice! Before you start closing fixed issues, I'd like to ask you add short fix discription wherever possible, because it is sometimes hard to understand what is fixed and how, especially in ambiguous cases. BTW, D1 is 2 years old by now (DMD1.000 was released on January, 2 in 2007). Congratulations!
Jan 06 2009
V 1.039 compiles my dlibs fine, but I have not timed the compilation times yet. The long divides are much faster than before and almost as the ones done by GCC, good work. The timings of the division benchmark I have shown last time: DMD1.038: 63.7 s DMD1.039: 12.2 s GCC4.2.1: 11.1 s Regarding the pure optimizations done by D2, how can the LDC compiler do the same? Are them done by the front-end? Bye, bearophile
Jan 06 2009
bearophile wrote:The long divides are much faster than before and almost as the ones done by GCC, good work. The timings of the division benchmark I have shown last time: DMD1.038: 63.7 s DMD1.039: 12.2 s GCC4.2.1: 11.1 s Regarding the pure optimizations done by D2, how can the LDC compiler do the same? Are them done by the front-end?I changed nothing with the compiler. I just rewrote the runtime long division function.
Jan 06 2009
On Wed, Jan 7, 2009 at 12:31 AM, Walter Bright <newshound1 digitalmars.com> wrote:Can you say "non sequitur"? He asked about "pure" optimization, not long division.Regarding the pure optimizations done by D2, how can the LDC compiler do the same? Are them done by the front-end?I changed nothing with the compiler. I just rewrote the runtime long division function.
Jan 07 2009
On Wed, Jan 7, 2009 at 2:10 PM, bearophile <bearophileHUGS lycos.com> wrote:V 1.039 compiles my dlibs fine, but I have not timed the compilation times yet. The long divides are much faster than before and almost as the ones done by GCC, good work. The timings of the division benchmark I have shown last time: DMD1.038: 63.7 s DMD1.039: 12.2 s GCC4.2.1: 11.1 s Regarding the pure optimizations done by D2, how can the LDC compiler do the same? Are them done by the front-end?Rockin'. Compile times seem unchanged wrt DMD 1.037 here too. Partial IFTI here I come! -- bb
Jan 06 2009
It appears that you've also fixed http://d.puremagic.com/issues/show_bug.cgi?id=2359 :D /* which might've been the same issue as http://d.puremagic.com/issues/show_bug.cgi?id=2527 */ Perhaps I can finally update from 1.031 :> Thanks a bunch! -- Tomasz Stachowiak http://h3.team0xf.com/ h3/h3r3tic on #D freenode
Jan 07 2009
I'm happy to see Bugzilla 2518(scope(success) not execuate and RAII variable destructor is not called) has been fixed, Great ! I have some questions when I check dstress suite and Bugzilla. In Bugzilla 99, according to test case: int main(){ int i; label: { scope(exit) i++; i=3; } if(i != 4){ assert(0); } return 0; } You said: The test case behaves as expected, because labels do not introduce a new scope when followed by { }. Then I check the online manual, and found: labels, scope(), pragma, condition compile(version/debug/static if) would be followed by NonScopeStatement. It is easy to understand scope/condition compile followed by a NonScopeStatement, but what is the meaning of "Labeled Statements" + NonScopeStatement ? If I understand the rule I would make least mistakes, so can you do some explain for me ? Thanks. Walter Bright Wrote:Faster long divides! http://www.digitalmars.com/d/1.0/changelog.html http://ftp.digitalmars.com/dmd.1.039.zip http://www.digitalmars.com/d/2.0/changelog.html http://ftp.digitalmars.com/dmd.2.023.zip
Jan 07 2009
redsea wrote:I'm happy to see Bugzilla 2518(scope(success) not execuate and RAII variable destructor is not called) has been fixed, Great ! I have some questions when I check dstress suite and Bugzilla. In Bugzilla 99, according to test case: int main(){ int i; label: { scope(exit) i++; i=3; } if(i != 4){ assert(0); } return 0; } You said: The test case behaves as expected, because labels do not introduce a new scope when followed by { }. Then I check the online manual, and found: labels, scope(), pragma, condition compile(version/debug/static if) would be followed by NonScopeStatement. It is easy to understand scope/condition compile followed by a NonScopeStatement, but what is the meaning of "Labeled Statements" + NonScopeStatement ?A NonScopeStatement is a statement that, even if it has { }, does not introduce a new scope.If I understand the rule I would make least mistakes, so can you do some explain for me ? Thanks.
Jan 07 2009
Walter Bright Wrote:redsea wrote:I don't think this answers their question. What curly braces mean after a label is clearly a design decision that you made when writing D. It seems that the choice is the opposite of what people expect. Can you explain why it should be NonScope?I'm happy to see Bugzilla 2518(scope(success) not execuate and RAII variable destructor is not called) has been fixed, Great ! I have some questions when I check dstress suite and Bugzilla. In Bugzilla 99, according to test case: int main(){ int i; label: { scope(exit) i++; i=3; } if(i != 4){ assert(0); } return 0; } You said: The test case behaves as expected, because labels do not introduce a new scope when followed by { }. Then I check the online manual, and found: labels, scope(), pragma, condition compile(version/debug/static if) would be followed by NonScopeStatement. It is easy to understand scope/condition compile followed by a NonScopeStatement, but what is the meaning of "Labeled Statements" + NonScopeStatement ?A NonScopeStatement is a statement that, even if it has { }, does not introduce a new scope.If I understand the rule I would make least mistakes, so can you do some explain for me ? Thanks.
Jan 07 2009
Jason House wrote:Walter Bright Wrote:Restating in the form of a question... When would you _ever_ want {...} to not form a scope? Later, Bradredsea wrote:I don't think this answers their question. What curly braces mean after a label is clearly a design decision that you made when writing D. It seems that the choice is the opposite of what people expect. Can you explain why it should be NonScope?I'm happy to see Bugzilla 2518(scope(success) not execuate and RAII variable destructor is not called) has been fixed, Great ! I have some questions when I check dstress suite and Bugzilla. In Bugzilla 99, according to test case: int main(){ int i; label: { scope(exit) i++; i=3; } if(i != 4){ assert(0); } return 0; } You said: The test case behaves as expected, because labels do not introduce a new scope when followed by { }. Then I check the online manual, and found: labels, scope(), pragma, condition compile(version/debug/static if) would be followed by NonScopeStatement. It is easy to understand scope/condition compile followed by a NonScopeStatement, but what is the meaning of "Labeled Statements" + NonScopeStatement ?A NonScopeStatement is a statement that, even if it has { }, does not introduce a new scope.
Jan 07 2009
On Thu, 08 Jan 2009 06:25:11 +0300, Brad Roberts <braddr puremagic.com> wrote:Jason House wrote:The only possible example I can think of is a case inside switch: switch (i) { case 42: { } }Walter Bright Wrote:Restating in the form of a question... When would you _ever_ want {...} to not form a scope? Later, Bradredsea wrote:I don't think this answers their question. What curly braces mean after a label is clearly a design decision that you made when writing D. It seems that the choice is the opposite of what people expect. Can you explain why it should be NonScope?I'm happy to see Bugzilla 2518(scope(success) not execuate and RAII variable destructor is not called) has been fixed, Great ! I have some questions when I check dstress suite and Bugzilla. In Bugzilla 99, according to test case: int main(){ int i; label: { scope(exit) i++; i=3; } if(i != 4){ assert(0); } return 0; } You said: The test case behaves as expected, because labels do not introduce a new scope when followed by { }. Then I check the online manual, and found: labels, scope(), pragma, condition compile(version/debug/static if) would be followed by NonScopeStatement. It is easy to understand scope/condition compile followed by a NonScopeStatement, but what is the meaning of "Labeled Statements" + NonScopeStatement ?A NonScopeStatement is a statement that, even if it has { }, does not introduce a new scope.
Jan 07 2009
Reply to Brad,Restating in the form of a question... When would you _ever_ want {...} to not form a scope?static if(foo) { int i; float x; }
Jan 07 2009
On Thu, 08 Jan 2009 07:22:53 +0300, BCS <ao pathlink.com> wrote:Reply to Brad,Yeah, and version(foo) belongs here, too.Restating in the form of a question... When would you _ever_ want {...} to not form a scope?static if(foo) { int i; float x; }
Jan 07 2009
On Thu, Jan 8, 2009 at 1:27 PM, Denis Koroskin <2korden gmail.com> wrote:On Thu, 08 Jan 2009 07:22:53 +0300, BCS <ao pathlink.com> wrote:I think I said this before, but I do think it would be nice if there was some kind of alternate non-scope block delimiter syntax in D. When you have static ifs mixed with regular ifs and versions it starts to be pretty difficult to see the flow of things. Something like static if (x) :: some stuff :: --bbReply to Brad,Yeah, and version(foo) belongs here, too.Restating in the form of a question... When would you _ever_ want {...} to not form a scope?static if(foo) { int i; float x; }
Jan 07 2009
BCS wrote:Reply to Brad,That and the version one are good examples. However, the case example isn't. It actually already forms a scope, and that's a good thing. Example: switch (foo) { case 1: { int i; } case 2: i = 0; // build error (error: undefined identifier i } Later, BradRestating in the form of a question... When would you _ever_ want {...} to not form a scope?static if(foo) { int i; float x; }
Jan 07 2009
Brad Roberts wrote:Jason House wrote:version (foo) { int i; } ... version (foo) { bar(i); } Writing labeled block statements is something more likely to be generated by an automated D code generator, and it's convenient to be able to control if a scope is generated or not.I don't think this answers their question. What curly braces mean after a label is clearly a design decision that you made when writing D. It seems that the choice is the opposite of what people expect. Can you explain why it should be NonScope?Restating in the form of a question... When would you _ever_ want {...} to not form a scope?
Jan 07 2009
Walter Bright wrote: <snip>Writing labeled block statements is something more likely to be generated by an automated D code generator,I still don't get it.and it's convenient to be able to control if a scope is generated or not.To force a block to create a scope: {{ ... }} To force a block not to create a scope: version (all) { ... } Stewart.
Jan 10 2009
Brad Roberts:Restating in the form of a question... When would you _ever_ want {...} to not form a scope?Recently I have shown a possible syntax for express general unsafeties in D code, for example: unsafe (bounds, overflow) { ... // here there's no array bound checks, not integral overflow checks } I think this safe(...){...} and unsafe(...){...} don't need to form a scope, like static if. -------------------------- Bill Baxter:I do think it would be nice if there was some kind of alternate non-scope block delimiter syntax in D. When you have static ifs mixed with regular ifs and versions it starts to be pretty difficult to see the flow of things. Something likestatic if (x) :: some stuff ::< Probably I don't understand that syntax. A more full example may help me understand it. But if I understand it correctly, then I don't like that syntax. The {} add a little of noise, but help you know for sure inside where you are (the alternative, if the indenting level are low enough is of course the Python stile). Your style (if I understand it correctly) reminds me the way you use in Pascal to define compiler directives in blocks of code, and it leads to troubles compared to the static if {} of D. Bye, bearophile
Jan 08 2009
On Thu, Jan 8, 2009 at 5:36 PM, bearophile <bearophileHUGS lycos.com> wrote:Brad Roberts:It just means curly braces. I don't really care what syntax it is, just something besides { and } for non-scope blocks.Restating in the form of a question... When would you _ever_ want {...} to not form a scope?Recently I have shown a possible syntax for express general unsafeties in D code, for example: unsafe (bounds, overflow) { ... // here there's no array bound checks, not integral overflow checks } I think this safe(...){...} and unsafe(...){...} don't need to form a scope, like static if. -------------------------- Bill Baxter:I do think it would be nice if there was some kind of alternate non-scope block delimiter syntax in D. When you have static ifs mixed with regular ifs and versions it starts to be pretty difficult to see the flow of things. Something likestatic if (x) :: some stuff ::< Probably I don't understand that syntax.A more full example may help me understand it. But if I understand it correctly, then I don't like that syntax. The {} add a little of noise, but help you know for sure inside where you areDo they really help you see where you are in something like this: void Do_something(T)(int i) { if (i == 0) { static if (is(T==A)) { A.SomeAlias x; } else static if(is(T==B)) { B.SubType x; } else { T x; } x = ... whatever } else { int y = x; } } To me it's hard to see those variable declarations as being anything other than scoped to the blocks they're in. So all I'm saying is if we could have some different delimiters for non-scope blocks then it might be nice, and make it easier to see when scopes are ending and when they are not. --bb
Jan 08 2009
Bill Baxter:To me it's hard to see those variable declarations as being anything other than scoped to the blocks they're in. So all I'm saying is if we could have some different delimiters for non-scope blocks then it might be nice, and make it easier to see when scopes are ending and when they are not.*Now* I understand, and I see your point. It's the usual problem: ASCII doesn't have enough ways to represent containers and delimiters :-) So if this is your original code (I have improved your indentations and improved readability a little): void doSomething(T)(int i) { if (i == 0) { static if (is(T == A)) { A.SomeAlias x; } else static if(is(T == B)) { B.SubType x; } else { T x; } x = ... whatever } else int y = x; } This can be the new version following your idea: void doSomething(T)(int i) { if (i == 0) { static if (is(T == A)) :: A.SomeAlias x; :: else static if(is(T == B)) :: B.SubType x; :: else :: T x; :: x = ... whatever } else int y = x; } But the problem is that :: don't have a head and tail, so the code is even less easy to read. This version uses (* ... *), used in Pascal to denote comments: void doSomething(T)(int i) { if (i == 0) { static if (is(T == A)) (* A.SomeAlias x; *) else static if(is(T == B)) (* B.SubType x; *) else (* T x; *) x = ... whatever } else int y = x; } I don't like that too, even if it's a bit better than the version with ::. Two other possibilities: void doSomething(T)(int i) { if (i == 0) { static if (is(T == A)) {| A.SomeAlias x; |} else static if(is(T == B)) {| B.SubType x; |} else {| T x; |} x = ... whatever } else int y = x; } void doSomething(T)(int i) { if (i == 0) { A.SomeAlias x; B.SubType x; T x; x = ... whatever } else int y = x; } I don't think lot of people will appreciate those. So the lack of different block delimiters may make this problem have no better solution. Bye, bearophile
Jan 08 2009
bearophile wrote:Bill Baxter:syntax is interpreted by the compiler. the above would be something like: void doSomething(T)(int i) { if (i == 0) { #if (is(T == A)) A.SomeAlias x; #elif (is(T == B)) B.SubType x; #else T x; #endif x = ... whatever } else int y = x; } D can always revert to this kind of syntax for compile time code.To me it's hard to see those variable declarations as being anything other than scoped to the blocks they're in. So all I'm saying is if we could have some different delimiters for non-scope blocks then it might be nice, and make it easier to see when scopes are ending and when they are not.*Now* I understand, and I see your point. It's the usual problem: ASCII doesn't have enough ways to represent containers and delimiters :-) So if this is your original code (I have improved your indentations and improved readability a little): void doSomething(T)(int i) { if (i == 0) { static if (is(T == A)) { A.SomeAlias x; } else static if(is(T == B)) { B.SubType x; } else { T x; } x = ... whatever } else int y = x; } This can be the new version following your idea: void doSomething(T)(int i) { if (i == 0) { static if (is(T == A)) :: A.SomeAlias x; :: else static if(is(T == B)) :: B.SubType x; :: else :: T x; :: x = ... whatever } else int y = x; } But the problem is that :: don't have a head and tail, so the code is even less easy to read. This version uses (* ... *), used in Pascal to denote comments: void doSomething(T)(int i) { if (i == 0) { static if (is(T == A)) (* A.SomeAlias x; *) else static if(is(T == B)) (* B.SubType x; *) else (* T x; *) x = ... whatever } else int y = x; } I don't like that too, even if it's a bit better than the version with ::. Two other possibilities: void doSomething(T)(int i) { if (i == 0) { static if (is(T == A)) {| A.SomeAlias x; |} else static if(is(T == B)) {| B.SubType x; |} else {| T x; |} x = ... whatever } else int y = x; } void doSomething(T)(int i) { if (i == 0) { A.SomeAlias x; B.SubType x; T x; x = ... whatever } else int y = x; } I don't think lot of people will appreciate those. So the lack of different block delimiters may make this problem have no better solution. Bye, bearophile
Jan 16 2009
On Sat, Jan 17, 2009 at 6:26 AM, Yigal Chripun <yigal100 gmail.com> wrote:bearophile wrote:I kinda like that, actually, but I doubt it'll be very popular around here. --bbBill Baxter:syntax is interpreted by the compiler. the above would be something like: void doSomething(T)(int i) { if (i == 0) { #if (is(T == A)) A.SomeAlias x; #elif (is(T == B)) B.SubType x; #else T x; #endif x = ... whatever } else int y = x; } D can always revert to this kind of syntax for compile time code.To me it's hard to see those variable declarations as being anything other than scoped to the blocks they're in. So all I'm saying is if we could have some different delimiters for non-scope blocks then it might be nice, and make it easier to see when scopes are ending and when they are not.*Now* I understand, and I see your point. It's the usual problem: ASCII doesn't have enough ways to represent containers and delimiters :-) So if this is your original code (I have improved your indentations and improved readability a little): [...] I don't think lot of people will appreciate those. So the lack of different block delimiters may make this problem have no better solution. Bye, bearophile
Jan 16 2009
Bill Baxter wrote:[snip]that those statements are handled at "compile time." The problem, of course, is that they're really nothing like C preprocessor statements. They have a different syntax, and completely different capabilities. What's more, you can't mix them across statements/expressions, so I suspect it would just cause more confusion. Additionally, there's this: #endif Unless you plan on moving all control structures to BASIC/pascal style, I don't think it's wise to start mixing them all over the place. I do like the idea of a "scopeless block" syntax in theory, though it's not something that's really been an issue for me. -- Danielsyntax is interpreted by the compiler. the above would be something like: void doSomething(T)(int i) { if (i == 0) { #if (is(T == A)) A.SomeAlias x; #elif (is(T == B)) B.SubType x; #else T x; #endif x = ... whatever } else int y = x; } D can always revert to this kind of syntax for compile time code.I kinda like that, actually, but I doubt it'll be very popular around here. --bb
Jan 16 2009
On Sat, 17 Jan 2009 06:17:57 +0300, Daniel Keep <daniel.keep.lists gmail.com> wrote:Bill Baxter wrote:Well, syntax could be different: void doSomething(T)(int i) { if (i == 0) { #if (is(T == A)) { A.SomeAlias x; B.SubType x; T x; x = ... whatever } else int y = x; }[snip]that those statements are handled at "compile time." The problem, of course, is that they're really nothing like C preprocessor statements. They have a different syntax, and completely different capabilities. What's more, you can't mix them across statements/expressions, so I suspect it would just cause more confusion. Additionally, there's this: #endif Unless you plan on moving all control structures to BASIC/pascal style, I don't think it's wise to start mixing them all over the place. I do like the idea of a "scopeless block" syntax in theory, though it's not something that's really been an issue for me. -- Danielthe syntax is interpreted by the compiler. the above would be something like: void doSomething(T)(int i) { if (i == 0) { #if (is(T == A)) A.SomeAlias x; #elif (is(T == B)) B.SubType x; #else T x; #endif x = ... whatever } else int y = x; } D can always revert to this kind of syntax for compile time code.I kinda like that, actually, but I doubt it'll be very popular around here. --bb
Jan 16 2009
Denis Koroskin:void doSomething(T)(int i) { if (i == 0) { #if (is(T == A)) { A.SomeAlias x; B.SubType x; T x; x = ... whatever } else int y = x; }A.SomeAlias x; Bye, bearophile
Jan 17 2009
On 2009-01-16 22:17:57 -0500, Daniel Keep <daniel.keep.lists gmail.com> said:that those statements are handled at "compile time." The problem, of course, is that they're really nothing like C preprocessor statements. They have a different syntax, and completely different capabilities. What's more, you can't mix them across statements/expressions, so I suspect it would just cause more confusion. Additionally, there's this: #endif Unless you plan on moving all control structures to BASIC/pascal style, I don't think it's wise to start mixing them all over the place.All good reasons, but there is one more: If you use #if in the standard D language, then it'll make it harder to use a real C preprocessor when you need it. D has support for #line in the language so that the compiler gives you error messages relative to the right included file and line in a preprocessor output. D doesn't have a preprocessor built-in, and doesn't recommand using one either, but it has support for it. Introducing #if in the D language would break that support.I do like the idea of a "scopeless block" syntax in theory, though it's not something that's really been an issue for me.Me neither. -- Michel Fortin michel.fortin michelf.com http://michelf.com/
Jan 17 2009
"Michel Fortin" <michel.fortin michelf.com> wrote in message news:gksbop$2ttr$1 digitalmars.com...On 2009-01-16 22:17:57 -0500, Daniel Keep <daniel.keep.lists gmail.com> said:The only time I've had a problem with any scope/scopeless block issue is having gotten bitten once by the inability to use a mixin to declare a scope object (since it only lives within the mixin's own implicit scope and not the scope where the mixin is instantiated (as I would have expected)...which does seem odd now that I think about it, because an "int a", for instance, declared inside a mixin still outlives the mixin, even though I don't think that happens with an explicit block). But that doesn't really need a special "scopeless block" syntax to be fixed.that those statements are handled at "compile time." The problem, of course, is that they're really nothing like C preprocessor statements. They have a different syntax, and completely different capabilities. What's more, you can't mix them across statements/expressions, so I suspect it would just cause more confusion. Additionally, there's this: #endif Unless you plan on moving all control structures to BASIC/pascal style, I don't think it's wise to start mixing them all over the place.All good reasons, but there is one more: If you use #if in the standard D language, then it'll make it harder to use a real C preprocessor when you need it. D has support for #line in the language so that the compiler gives you error messages relative to the right included file and line in a preprocessor output. D doesn't have a preprocessor built-in, and doesn't recommand using one either, but it has support for it. Introducing #if in the D language would break that support.I do like the idea of a "scopeless block" syntax in theory, though it's not something that's really been an issue for me.Me neither.
Jan 17 2009
Bill Baxter Wrote:On Thu, Jan 8, 2009 at 5:36 PM, bearophile <bearophileHUGS lycos.com> wrote:I'd do: void Do_something(T)(int i) { if (i == 0) { static if (is(T==A)) { A.SomeAlias x; } else static if(is(T==B)) { B.SubType x; } else { T x; } x = ... whatever } else { int y = x; } } it's parallel programming...Brad Roberts:It just means curly braces. I don't really care what syntax it is, just something besides { and } for non-scope blocks.Restating in the form of a question... When would you _ever_ want {...} to not form a scope?Recently I have shown a possible syntax for express general unsafeties in D code, for example: unsafe (bounds, overflow) { ... // here there's no array bound checks, not integral overflow checks } I think this safe(...){...} and unsafe(...){...} don't need to form a scope, like static if. -------------------------- Bill Baxter:I do think it would be nice if there was some kind of alternate non-scope block delimiter syntax in D. When you have static ifs mixed with regular ifs and versions it starts to be pretty difficult to see the flow of things. Something likestatic if (x) :: some stuff ::< Probably I don't understand that syntax.A more full example may help me understand it. But if I understand it correctly, then I don't like that syntax. The {} add a little of noise, but help you know for sure inside where you areDo they really help you see where you are in something like this: void Do_something(T)(int i) { if (i == 0) { static if (is(T==A)) { A.SomeAlias x; } else static if(is(T==B)) { B.SubType x; } else { T x; } x = ... whatever } else { int y = x; } } To me it's hard to see those variable declarations as being anything other than scoped to the blocks they're in. So all I'm saying is if we could have some different delimiters for non-scope blocks then it might be nice, and make it easier to see when scopes are ending and when they are not. --bb
Jan 08 2009
On Fri, Jan 9, 2009 at 4:29 AM, Nicolas <dransic free.fr> wrote:Bill Baxter Wrote:I'm having trouble resisting the urge to re-indent that code. It totally looks like someone got their tabs and spaces mixed up. --bbOn Thu, Jan 8, 2009 at 5:36 PM, bearophile <bearophileHUGS lycos.com> wrote:I'd do: void Do_something(T)(int i) { if (i == 0) { static if (is(T==A)) { A.SomeAlias x; } else static if(is(T==B)) { B.SubType x; } else { T x; } x = ... whatever } else { int y = x; } } it's parallel programming...Brad Roberts:It just means curly braces. I don't really care what syntax it is, just something besides { and } for non-scope blocks.Restating in the form of a question... When would you _ever_ want {...} to not form a scope?Recently I have shown a possible syntax for express general unsafeties in D code, for example: unsafe (bounds, overflow) { ... // here there's no array bound checks, not integral overflow checks } I think this safe(...){...} and unsafe(...){...} don't need to form a scope, like static if. -------------------------- Bill Baxter:I do think it would be nice if there was some kind of alternate non-scope block delimiter syntax in D. When you have static ifs mixed with regular ifs and versions it starts to be pretty difficult to see the flow of things. Something likestatic if (x) :: some stuff ::< Probably I don't understand that syntax.A more full example may help me understand it. But if I understand it correctly, then I don't like that syntax. The {} add a little of noise, but help you know for sure inside where you areDo they really help you see where you are in something like this: void Do_something(T)(int i) { if (i == 0) { static if (is(T==A)) { A.SomeAlias x; } else static if(is(T==B)) { B.SubType x; } else { T x; } x = ... whatever } else { int y = x; } } To me it's hard to see those variable declarations as being anything other than scoped to the blocks they're in. So all I'm saying is if we could have some different delimiters for non-scope blocks then it might be nice, and make it easier to see when scopes are ending and when they are not. --bb
Jan 08 2009
"2527: Alias Template Params Are Always Same Type As First Instantiation (according to typeof(x).stringof)" Hooray! Thanks :) That one's a big help for me.
Jan 07 2009
Walter Bright Wrote:Faster long divides! http://www.digitalmars.com/d/1.0/changelog.html http://ftp.digitalmars.com/dmd.1.039.zip http://www.digitalmars.com/d/2.0/changelog.html http://ftp.digitalmars.com/dmd.2.023.zipIt's nice to see the backend uses pure. When will Phobos?
Jan 07 2009
Jason House wrote:Walter Bright Wrote:Yes. :o) AndreiFaster long divides! http://www.digitalmars.com/d/1.0/changelog.html http://ftp.digitalmars.com/dmd.1.039.zip http://www.digitalmars.com/d/2.0/changelog.html http://ftp.digitalmars.com/dmd.2.023.zipIt's nice to see the backend uses pure. When will Phobos?
Jan 07 2009
On Thu, 08 Jan 2009 05:09:50 +0300, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:Jason House wrote:Yes? O_oWalter Bright Wrote:Yes. :o) AndreiFaster long divides! http://www.digitalmars.com/d/1.0/changelog.html http://ftp.digitalmars.com/dmd.1.039.zip http://www.digitalmars.com/d/2.0/changelog.html http://ftp.digitalmars.com/dmd.2.023.zipIt's nice to see the backend uses pure. When will Phobos?
Jan 07 2009