D - dmd 30
- Walter (2/2) Apr 27 2002 Fixed several reported bugs.
- Burton Radons (38/38) Apr 29 2002 Walter asked me to post this part of a private response here.
- Walter (11/34) Apr 29 2002 Not sure what you mean.
- Pavel Minayev (5/10) Apr 29 2002 Import foo for your own use (other modules don't see it).
- Burton Radons (25/49) Apr 29 2002 Whoops, I forgot all about static. All I meant was static in the C
- Burton Radons (37/47) Apr 29 2002 This demands a little more explanation since a feature this affecting
- Burton Radons (7/12) Apr 30 2002 Whoops, short, bit, byte, and ubyte should be casted into 32-bit
- Pavel Minayev (16/32) Apr 30 2002 Agreed. D strings are char[] and wchar[].
- Burton Radons (26/54) May 01 2002 [snip]
- Pavel Minayev (4/17) May 01 2002 Okay, I get the idea.
- Walter (3/4) Apr 30 2002 Be careful about the copyright/license status of DJGPP's source.
- Burton Radons (3/7) Apr 30 2002 I didn't use it anyway.
- Stephen Fuld (16/31) May 03 2002 Some time ago, I requested that printf fix my favorite usability gripe w...
- Burton Radons (15/45) May 03 2002 This could tie into the regional settings facility of modern OSes to
- Stephen Fuld (17/65) May 05 2002 with
- Pavel Minayev (4/10) May 05 2002 So, back to the locales library...
- Stephen Fuld (7/17) May 06 2002 If
- Burton Radons (7/18) May 06 2002 [snip]
- Stephen Fuld (7/26) May 06 2002 I wasn't trying to exaggerate the difficulty - in fact just the opposite...
- Walter (3/6) Apr 30 2002 Ok, I have it fixed now. Will go out in the next update.
Fixed several reported bugs. ftp://ftp.digitalmars.com/dmdalpha.zip
Apr 27 2002
Walter asked me to post this part of a private response here. Phobos compiles nicely now, thanks. I converted the Python random module over to D [and attached it]. Observations coming out of this. If the private keyword is attached to a module symbol, that symbol shouldn't be included in import. This would be useful to keep namespace pollution down and minimise the necessity for obfuscated symbol names. This would also be very useful for linking to the CRT without exporting the otherwise useless symbols. In fact, this is necessary to avoid conflicts: date and math conflict with one another; they both export floor. swap(a, b) would be nice as a kind of compile-time statement. Default arguments would be nice. Most of the time I can get around them (and most of the time I couldn't use them even if they were there), but there's that 1% that is really a pain to deal with. Some kind of printf that returns the result would be very nice. fmt(), say. Such as: [snip code] shuffle is missing [from the class I converted]. This randomizes the entries of an array in place. I think this should wait for a kind of template system; for example, choice could be implemented as: $type choice($type[] array) { return array[range(array.length)]; } Much shorter than anything you can do in C++, and I think clearer. Not to mention it being impossible in C++ to my knowledge. Such methods, of course, cannot be virtual or overloaded. As to structs and classes, C++'s facility isn't too bad. Isn't too great either (much too much ugly), but I can't think of a better way. I collided with a bunch of array problems that caused internal errors. I'll collect a couple of test cases and pipe them to you. (4 % 1.0) returns -nan. The documentation is ambiguous as to whether modulus should work here, but it sure doesn't, and there's no facility for doing it otherwise. I pull in fmod for the interim. Suddenly have a need for bignums. It can wait, not really an important part of the RNG. Not right now, but my later use of D will be conditional on operator overloading. It's too important for 3D games work. Just in case you thought that games programmers could accept a language without operator overloading; we can't, period, full stop. I'm sure mathematics programmers are even more adamant about it.
Apr 29 2002
"Burton Radons" <loth users.sourceforge.net> wrote in message news:mcercusasglvehmssbnrhq475h7ashsh51 4ax.com...If the private keyword is attached to a module symbol, that symbol shouldn't be included in import. This would be useful to keep namespace pollution down and minimise the necessity for obfuscated symbol names. This would also be very useful for linking to the CRT without exporting the otherwise useless symbols. In fact, this is necessary to avoid conflicts: date and math conflict with one another; they both export floor.Not sure what you mean. private import foo; ??swap(a, b) would be nice as a kind of compile-time statement.I'd rather reserve that as a test case for implementing generics.Default arguments would be nice. Most of the time I can get around them (and most of the time I couldn't use them even if they were there), but there's that 1% that is really a pain to deal with.There was a looong thread about that!Some kind of printf that returns the result would be very nice. fmt(), say. Such as: [snip code]Yes, a D-ized version of printf is needed.I collided with a bunch of array problems that caused internal errors. I'll collect a couple of test cases and pipe them to you.Ok, I want to fix them.(4 % 1.0) returns -nan. The documentation is ambiguous as to whether modulus should work here, but it sure doesn't, and there's no facility for doing it otherwise. I pull in fmod for the interim.Ak! (It should work.)Not right now, but my later use of D will be conditional on operator overloading. It's too important for 3D games work. Just in case you thought that games programmers could accept a language without operator overloading; we can't, period, full stop. I'm sure mathematics programmers are even more adamant about it.A lot of people have asked for it. You're probably right.
Apr 29 2002
"Walter" <walter digitalmars.com> wrote in message news:aal1h8$23cc$2 digitaldaemon.com...Not sure what you mean. private import foo; ??Import foo for your own use (other modules don't see it).Earlier, I suggested a swap operator: a <-> bswap(a, b) would be nice as a kind of compile-time statement.I'd rather reserve that as a test case for implementing generics.
Apr 29 2002
On Mon, 29 Apr 2002 20:01:49 -0700, "Walter" <walter digitalmars.com> wrote:"Burton Radons" <loth users.sourceforge.net> wrote in message news:mcercusasglvehmssbnrhq475h7ashsh51 4ax.com...Whoops, I forgot all about static. All I meant was static in the C source file tradition, but applicable to any symbol.If the private keyword is attached to a module symbol, that symbol shouldn't be included in import. This would be useful to keep namespace pollution down and minimise the necessity for obfuscated symbol names. This would also be very useful for linking to the CRT without exporting the otherwise useless symbols. In fact, this is necessary to avoid conflicts: date and math conflict with one another; they both export floor.Not sure what you mean. private import foo; ??Sure. In my style that would be, I think: void swap(inout $what a, inout $what b) { $what c = a; a = b; b = c; }swap(a, b) would be nice as a kind of compile-time statement.I'd rather reserve that as a test case for implementing generics.Okay, I'll search the archives. 4639 messages takes awhile to get through. :-)Default arguments would be nice. Most of the time I can get around them (and most of the time I couldn't use them even if they were there), but there's that 1% that is really a pain to deal with.There was a looong thread about that!Speak of the devil. Working on it this very moment. It's going to be wchar through and through if you don't mind.Some kind of printf that returns the result would be very nice. fmt(), say. Such as: [snip code]Yes, a D-ized version of printf is needed.class gap { this(char[3] cad) { } } unittest { char[3] foo; gap g; g = new gap(foo); } Reports "Internal error: ..\ztc\cod1.c 2390" using 0.30. Uh... I'll have to do more testing, I got a couple others, but I think it was always the same internal error. Note that normal functions take the array just fine. [snip]I collided with a bunch of array problems that caused internal errors. I'll collect a couple of test cases and pipe them to you.Ok, I want to fix them.
Apr 29 2002
On Mon, 29 Apr 2002 20:57:44 -0700, Burton Radons <loth users.sourceforge.net> wrote:On Mon, 29 Apr 2002 20:01:49 -0700, "Walter" <walter digitalmars.com> wrote:This demands a little more explanation since a feature this affecting deserves a debate. I'd like to hear what people want from this thing. Internally the class structure is such. FormatFlags holds code data, such as for a "%4d", including all the information. FormatType handles the code types, such as a class for "%s" and "%S". FormatParser brings it together, and there's an instance of that class used internally by fmt (a variant of printf that returns the parsed result). Only FormatFlags is public, the rest are internal. Restricted compilation won't have any troubles; just do the same checking that GCC does of the arguments in printf. It's a super handy feature that I really miss while working in Windows. I think that "%s" and "%S" should expect char[] and wchar[] respectively by default, since we rarely deal with char* and wchar*. If necessary you can force one of those by using "%+s" and "%+S". Perhaps even that should be removed. For printing objects we use "%o". This calls the new toFormat (?) method of the object, sending it the FormatFlags so that it can do tricky things to it. Normally this would just call toString. Oh, and a string without any other limits on it defaults to (wchar*); I was kind of expecting (wchar[]). So this is incorrect in the current release: fmt ("%d blue borg%S", count, count == 1 ? "" : "s"); Instead it would have to be: fmt ("%d blue borg%+S", count, count == 1 ? "\0" : "s\0"); or: fmt ("%d blue borg%S", count, (wchar[]) (count == 1 ? "" : "s")); Uh, that is, if you can do that cast. Perhaps it would have to be: fmt ("%d blue borg%S", count, count == 1 ? (wchar[]) "" : (wchar[]) "s"); In any case, none of these are as convenient as the first version. "%ld" is our long (64-bit) in my implementation, rather than C's weird mechanism. I don't handle short or bit, ideas? What about byte and ubyte? What about complex and extended? I'm currently done except for floating point and lots and lots of unittesting. I'll have to get DJGPP's source for FP, tricky stuff."Burton Radons" <loth users.sourceforge.net> wrote in message news:mcercusasglvehmssbnrhq475h7ashsh51 4ax.com...Speak of the devil. Working on it this very moment. It's going to be wchar through and through if you don't mind.Some kind of printf that returns the result would be very nice. fmt(), say. Such as: [snip code]Yes, a D-ized version of printf is needed.
Apr 29 2002
On Mon, 29 Apr 2002 23:51:35 -0700, Burton Radons <loth users.sourceforge.net> wrote:On Mon, 29 Apr 2002 20:57:44 -0700, Burton Radons <loth users.sourceforge.net> wrote: "%ld" is our long (64-bit) in my implementation, rather than C's weird mechanism. I don't handle short or bit, ideas? What about byte and ubyte? What about complex and extended?Whoops, short, bit, byte, and ubyte should be casted into 32-bit integers by dmd so never mind. I think that extended could be supported using l, so "%lg" is an extended. I have no idea what to do with complex; perhaps it should
Apr 30 2002
"Burton Radons" <loth users.sourceforge.net> wrote in message news:5jascu4ff6rrdbhd5iptdo81mgvvoao4cj 4ax.com...I think that "%s" and "%S" should expect char[] and wchar[] respectively by default, since we rarely deal with char* and wchar*.Agreed. D strings are char[] and wchar[].If necessary you can force one of those by using "%+s" and "%+S". Perhaps even that should be removed.I'd leave it for some sort of compatibility (just when you need to print an LPSTR =))For printing objects we use "%o". This calls the new toFormat (?) method of the object, sending it the FormatFlags so that it can do tricky things to it. Normally this would just call toString.Format flags on object - how'd this look?.. Apple apple; fmt("%o", apple); Where do I put those flags here?Oh, and a string without any other limits on it defaults to (wchar*); I was kind of expecting (wchar[]). So this is incorrect in the current release: fmt ("%d blue borg%S", count, count == 1 ? "" : "s"); Instead it would have to be: fmt ("%d blue borg%+S", count, count == 1 ? "\0" : "s\0");Hm... I thought string literals are of type char[] (or wchar[])..."%ld" is our long (64-bit) in my implementation, rather than C's weird mechanism. I don't handle short or bit, ideas? What about byte and ubyte? What about complex and extended?byte and short are converted to int when passing to vararg-functions, so no need to worry about it. You could add a bit type (%b?), so it'd print "true" and "false", but I guess it is passed as int as well. extended should be %lf, %lg, or %le, I think. imaginary could be %If, %Ig and %Ce, and complex - %Cf, %Cg and %Ce.
Apr 30 2002
On Tue, 30 Apr 2002 15:47:01 +0400, "Pavel Minayev" <evilone omen.ru> wrote:"Burton Radons" <loth users.sourceforge.net> wrote in message news:5jascu4ff6rrdbhd5iptdo81mgvvoao4cj 4ax.com...[snip]Apple could have the class: class Apple { wchar [] toFormat (FormatFlags flags) { if (find (flags.string, "+")) return "a red and juicy apple"; return "apple"; } } I aborted this facility for now as FormatFlags would have to be moved to object.d. Walter can make that change to the code I sent him if he wants (you did get that code, right Walter?) At the moment it just uses toString. Oh, and it's "%r" instead. "%o" is an octal.For printing objects we use "%o". This calls the new toFormat (?) method of the object, sending it the FormatFlags so that it can do tricky things to it. Normally this would just call toString.Format flags on object - how'd this look?.. Apple apple; fmt("%o", apple); Where do I put those flags here?Depends upon the context. Without a context it defaults to wchar* for now.Oh, and a string without any other limits on it defaults to (wchar*); I was kind of expecting (wchar[]). So this is incorrect in the current release: fmt ("%d blue borg%S", count, count == 1 ? "" : "s"); Instead it would have to be: fmt ("%d blue borg%+S", count, count == 1 ? "\0" : "s\0");Hm... I thought string literals are of type char[] (or wchar[])..."%b" is free. Let's not support it for now and see whether it's a requested feature; don't want to waste a formatting code if it's not used."%ld" is our long (64-bit) in my implementation, rather than C's weird mechanism. I don't handle short or bit, ideas? What about byte and ubyte? What about complex and extended?byte and short are converted to int when passing to vararg-functions, so no need to worry about it. You could add a bit type (%b?), so it'd print "true" and "false", but I guess it is passed as int as well.extended should be %lf, %lg, or %le, I think. imaginary could be %If, %Ig and %Ce, and complex - %Cf, %Cg and %Ce."%C" is a wide char, so no go there. I don't think %I would be very smart as many fonts render %l and %I identically. I'm letting it stew.
May 01 2002
"Burton Radons" <loth users.sourceforge.net> wrote in message news:fdg1dusukig9s1qvgsscsa1rt8oit9s1gs 4ax.com...Apple could have the class: class Apple { wchar [] toFormat (FormatFlags flags) { if (find (flags.string, "+")) return "a red and juicy apple"; return "apple"; } }Okay, I get the idea."%b" is free. Let's not support it for now and see whether it's a requested feature; don't want to waste a formatting code if it's not used.I think that printing booleans is not a rare operation.
May 01 2002
"Burton Radons" <loth users.sourceforge.net> wrote in message news:5jascu4ff6rrdbhd5iptdo81mgvvoao4cj 4ax.com...I'll have to get DJGPP's source for FP, tricky stuff.Be careful about the copyright/license status of DJGPP's source.
Apr 30 2002
On Tue, 30 Apr 2002 09:13:50 -0700, "Walter" <walter digitalmars.com> wrote:"Burton Radons" <loth users.sourceforge.net> wrote in message news:5jascu4ff6rrdbhd5iptdo81mgvvoao4cj 4ax.com...I didn't use it anyway.I'll have to get DJGPP's source for FP, tricky stuff.Be careful about the copyright/license status of DJGPP's source.
Apr 30 2002
"Burton Radons" <loth users.sourceforge.net> wrote in message news:5jascu4ff6rrdbhd5iptdo81mgvvoao4cj 4ax.com...On Mon, 29 Apr 2002 20:57:44 -0700, Burton Radons <loth users.sourceforge.net> wrote:Some time ago, I requested that printf fix my favorite usability gripe with printing numbers. It should allow replacing the period in the formatting string with a comma to indicate that commas should be put in every three places to the left of the decimal point. Thus, instead of say 6874934935.45 You would get 6,874,934,935.45 At a very modest cost, and no backward compatibility problems, you get a great improvement in readability. In that post - which I can't find the number of using find :-(, I had some other suggestions relating for easier to read numeric formatting, which I will be happy to share again if you are interested. -- - Stephen Fuld e-mail address disguised to prevent spamOn Mon, 29 Apr 2002 20:01:49 -0700, "Walter" <walter digitalmars.com> wrote:This demands a little more explanation since a feature this affecting deserves a debate. I'd like to hear what people want from this thing."Burton Radons" <loth users.sourceforge.net> wrote in message news:mcercusasglvehmssbnrhq475h7ashsh51 4ax.com...Speak of the devil. Working on it this very moment. It's going to be wchar through and through if you don't mind.Some kind of printf that returns the result would be very nice. fmt(), say. Such as: [snip code]Yes, a D-ized version of printf is needed.
May 03 2002
On Fri, 3 May 2002 08:49:58 -0700, "Stephen Fuld" <s.fuld.pleaseremove att.net> wrote:"Burton Radons" <loth users.sourceforge.net> wrote in message news:5jascu4ff6rrdbhd5iptdo81mgvvoao4cj 4ax.com...This could tie into the regional settings facility of modern OSes to produce correct numbers everywhere... see the "Regional Settings" tab on Windows' Control Panel. These could take up an "n" flag for number or a "$" flag for currency (for example). So I could have: fmt ("%nd %$g", 4545, 8783.232); Which would reply on my system with: 4,545 $8,783.23 Perhaps even "%$US.g" or "%$Euro.g". Java has solutions for this spread out all over the library. Currency, like proper date, is not a simple problem by any means. But supporting separated numbers and simple currency is pretty trivial. There's an MSDN page for the locale symbols at: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/HTML/_crt_locale.aspOn Mon, 29 Apr 2002 20:57:44 -0700, Burton Radons <loth users.sourceforge.net> wrote:Some time ago, I requested that printf fix my favorite usability gripe with printing numbers. It should allow replacing the period in the formatting string with a comma to indicate that commas should be put in every three places to the left of the decimal point. Thus, instead of say 6874934935.45 You would get 6,874,934,935.45 At a very modest cost, and no backward compatibility problems, you get a great improvement in readability. In that post - which I can't find the number of using find :-(, I had some other suggestions relating for easier to read numeric formatting, which I will be happy to share again if you are interested.On Mon, 29 Apr 2002 20:01:49 -0700, "Walter" <walter digitalmars.com> wrote:This demands a little more explanation since a feature this affecting deserves a debate. I'd like to hear what people want from this thing."Burton Radons" <loth users.sourceforge.net> wrote in message news:mcercusasglvehmssbnrhq475h7ashsh51 4ax.com...Speak of the devil. Working on it this very moment. It's going to be wchar through and through if you don't mind.Some kind of printf that returns the result would be very nice. fmt(), say. Such as: [snip code]Yes, a D-ized version of printf is needed.
May 03 2002
"Burton Radons" <loth users.sourceforge.net> wrote in message news:87o6duk1e2ik2o69rceihr3msq0lnq4l0e 4ax.com...On Fri, 3 May 2002 08:49:58 -0700, "Stephen Fuld" <s.fuld.pleaseremove att.net> wrote:with"Burton Radons" <loth users.sourceforge.net> wrote in message news:5jascu4ff6rrdbhd5iptdo81mgvvoao4cj 4ax.com...On Mon, 29 Apr 2002 20:57:44 -0700, Burton Radons <loth users.sourceforge.net> wrote:Some time ago, I requested that printf fix my favorite usability gripeOn Mon, 29 Apr 2002 20:01:49 -0700, "Walter" <walter digitalmars.com> wrote:This demands a little more explanation since a feature this affecting deserves a debate. I'd like to hear what people want from this thing."Burton Radons" <loth users.sourceforge.net> wrote in message news:mcercusasglvehmssbnrhq475h7ashsh51 4ax.com...Speak of the devil. Working on it this very moment. It's going to be wchar through and through if you don't mind.Some kind of printf that returns the result would be very nice. fmt(), say. Such as: [snip code]Yes, a D-ized version of printf is needed.easierprinting numbers. It should allow replacing the period in the formatting string with a comma to indicate that commas should be put in every three places to the left of the decimal point. Thus, instead of say 6874934935.45 You would get 6,874,934,935.45 At a very modest cost, and no backward compatibility problems, you get a great improvement in readability. In that post - which I can't find the number of using find :-(, I had some other suggestions relating forareto read numeric formatting, which I will be happy to share again if youI looked on my system and found the tab, but is seems not to make any difference as very few applications, and even Windows itself, seems to ignore it, at least as far as providing comma separation in numerif values.interested.This could tie into the regional settings facility of modern OSes to produce correct numbers everywhere... see the "Regional Settings" tab on Windows' Control Panel.These could take up an "n" flag for number or a "$" flag for currency (for example). So I could have: fmt ("%nd %$g", 4545, 8783.232); Which would reply on my system with: 4,545 $8,783.23 Perhaps even "%$US.g" or "%$Euro.g". Java has solutions for this spread out all over the library. Currency, like proper date, is not a simple problem by any means. But supporting separated numbers and simple currency is pretty trivial.Yes, I was suggesting the simple things that cover most of the cases. If someone later wants to do the full thing, more power to them. But if waiting for the full solution is the excuse for not solving the problem before in C, then we have waited far too long and the excuse is beyond credible. At least fix the simple case first and we can worry about the full solution later. -- - Stephen Fuld e-mail address disguised to prevent spam
May 05 2002
"Stephen Fuld" <s.fuld.pleaseremove att.net> wrote in message news:ab4vmr$q49$1 digitaldaemon.com...Yes, I was suggesting the simple things that cover most of the cases. If someone later wants to do the full thing, more power to them. But if waiting for the full solution is the excuse for not solving the problem before in C, then we have waited far too long and the excuse is beyond credible. At least fix the simple case first and we can worry about the full solution later.So, back to the locales library... I wonder if C++-like solution would suit here. What do you think?
May 05 2002
"Pavel Minayev" <evilone omen.ru> wrote in message news:ab546o$tng$1 digitaldaemon.com..."Stephen Fuld" <s.fuld.pleaseremove att.net> wrote in message news:ab4vmr$q49$1 digitaldaemon.com...IfYes, I was suggesting the simple things that cover most of the cases.I am not a C++ person, so I can't comment intelligently. -- - Stephen Fuld e-mail address disguised to prevent spamsomeone later wants to do the full thing, more power to them. But if waiting for the full solution is the excuse for not solving the problem before in C, then we have waited far too long and the excuse is beyond credible. At least fix the simple case first and we can worry about the full solution later.So, back to the locales library... I wonder if C++-like solution would suit here. What do you think?
May 06 2002
On Sun, 5 May 2002 21:06:04 -0700, "Stephen Fuld" <s.fuld.pleaseremove att.net> wrote:"Burton Radons" <loth users.sourceforge.net> wrote in message news:87o6duk1e2ik2o69rceihr3msq0lnq4l0e 4ax.com...[snip]You're exaggerating the difficulty of supporting number separations properly. Once Walter's finished his current work and put fmt in Phobos, I'll patch it up for numeric printing and send it off. There's no problem, I just can't do it this very instant for you.Java has solutions for this spread out all over the library. Currency, like proper date, is not a simple problem by any means. But supporting separated numbers and simple currency is pretty trivial.Yes, I was suggesting the simple things that cover most of the cases. If someone later wants to do the full thing, more power to them. But if waiting for the full solution is the excuse for not solving the problem before in C, then we have waited far too long and the excuse is beyond credible. At least fix the simple case first and we can worry about the full solution later.
May 06 2002
"Burton Radons" <loth users.sourceforge.net> wrote in message news:n7dcducl1caqs6i9l2odqaspbf63u67air 4ax.com...On Sun, 5 May 2002 21:06:04 -0700, "Stephen Fuld" <s.fuld.pleaseremove att.net> wrote:I wasn't trying to exaggerate the difficulty - in fact just the opposite. Your solution sounds great. Thanks. -- - Stephen Fuld e-mail address disguised to prevent spam"Burton Radons" <loth users.sourceforge.net> wrote in message news:87o6duk1e2ik2o69rceihr3msq0lnq4l0e 4ax.com...[snip]You're exaggerating the difficulty of supporting number separations properly. Once Walter's finished his current work and put fmt in Phobos, I'll patch it up for numeric printing and send it off. There's no problem, I just can't do it this very instant for you.Java has solutions for this spread out all over the library. Currency, like proper date, is not a simple problem by any means. But supporting separated numbers and simple currency is pretty trivial.Yes, I was suggesting the simple things that cover most of the cases. If someone later wants to do the full thing, more power to them. But if waiting for the full solution is the excuse for not solving the problem before in C, then we have waited far too long and the excuse is beyond credible. At least fix the simple case first and we can worry about the full solution later.
May 06 2002
"Burton Radons" <loth users.sourceforge.net> wrote in message news:mcercusasglvehmssbnrhq475h7ashsh51 4ax.com...(4 % 1.0) returns -nan. The documentation is ambiguous as to whether modulus should work here, but it sure doesn't, and there's no facility for doing it otherwise. I pull in fmod for the interim.Ok, I have it fixed now. Will go out in the next update.
Apr 30 2002