Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Robert Jacques
On Mon, 08 Mar 2010 16:42:54 -0500, Philippe Sigaud wrote: On Mon, Mar 8, 2010 at 14:22, Steven Schveighoffer wrote: The shrinkToFit name is not my favorite, anyone care to submit a better name? minimize is out because it has connotations of math already. minCapacity minimizeCapacity

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread bearophile
To try the new operators I have created this helper that works: auto operators(string[] items...) { struct Bunch { string[] items; bool opBinaryRight(string s:"in")(string item) { foreach (el; items) if (el == item) return true;

Re: obj2asm

2010-03-08 Thread Walter Bright
Trass3r wrote: obj2asm tells the tale. (obj2asm is an incredibly useful tool, I don't know why nobody uses it.) Maybe because it's not free (and not much advertised). obconv also supports disassembling various object file formats + conversion between them and it's open source: http://www.agner

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Robert Clipsham
On 08/03/10 23:35, Andrei Alexandrescu wrote: Man I can't wait for that book to be out. I suspect you're not the only one, I was filled with excitement when I saw the expected delivery date become earlier a few days ago, I'm eagerly awaiting it so I can start playing with D2 properly rather t

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread bearophile
Philippe Sigaud: > >writeln(typeid(typeof(a.init))); // prints: int > > > > ?! You mean typeof(a) != typeof((typeof(a)).init) ?! > > Ugh... I thought (int[2]).init was [0,0] and in general (T[n]).init was > [(T.init) n times] http://d.puremagic.com/issues/show_bug.cgi?id=3826 Bye, bearophi

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Andrei Alexandrescu
Robert Clipsham wrote: On 08/03/10 22:53, Andrei Alexandrescu wrote: What I usually do is: T foo(T)(T s) if (is(typeof(s + s))) { } Andrei That's far nicer, I keep forgetting about is(typeof()), thanks :) It'll be hard to forget once TDPL will be out there, the idiom is present in several

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Philippe Sigaud
>writeln(typeid(typeof(a.init))); // prints: int > ?! You mean typeof(a) != typeof((typeof(a)).init) ?! Ugh... I thought (int[2]).init was [0,0] and in general (T[n]).init was [(T.init) n times] >writeln(foo(a)); // test.d(14): Error: Array operation s + s not > implemented > } > > > B

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Robert Clipsham
On 08/03/10 22:53, Andrei Alexandrescu wrote: What I usually do is: T foo(T)(T s) if (is(typeof(s + s))) { } Andrei That's far nicer, I keep forgetting about is(typeof()), thanks :)

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread bearophile
Andrei Alexandrescu: > > I'll also point out that AAs have a default policy that is much more > > reasonable. > > I guess that should be changed too :o). -.- Bye, bearophile

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread bearophile
Andrei Alexandrescu: > What I usually do is: > T foo(T)(T s) if (is(typeof(s + s))) { > } Nice, thank you, I'll use that. (That solution too presents the bug 3903) Bye, bearophile

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread bearophile
> But now I don't know what's happening, because that trait correctly returns > false, but the compiler generates a compile error at line 14 still. I think > there's a new bug. I have added a bug: http://d.puremagic.com/issues/show_bug.cgi?id=3903 Bye, bearophile

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread bearophile
Robert Clipsham: > Untested, will the following do what you need? > > T foo(T)(T s) if (__traits(compiles, {return s + s;})) { > return s + s; > } > > Seems like you may as well test if you can add what you're passed rather > than the initial value for the type. Oh, nice, I didn't

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Andrei Alexandrescu
Robert Clipsham wrote: On 08/03/10 22:03, bearophile wrote: 2) What's the best way to translate this to the new operator regime? T foo(T)(T s) if (__traits(hasMember, T, "opAdd")) { return s + s; } I have not found a good solution yet. This solution looks buggy (also because fixed-sized

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Andrei Alexandrescu
Steven Schveighoffer wrote: On Mon, 08 Mar 2010 15:56:14 -0500, Andrei Alexandrescu wrote: Steven Schveighoffer wrote: On Mon, 08 Mar 2010 14:49:33 -0500, Andrei Alexandrescu wrote: bearophile wrote: Andrei Alexandrescu: Sorry, this stays. Then I'm not going to use the Phobos printi

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Robert Clipsham
On 08/03/10 22:03, bearophile wrote: 2) What's the best way to translate this to the new operator regime? T foo(T)(T s) if (__traits(hasMember, T, "opAdd")) { return s + s; } I have not found a good solution yet. This solution looks buggy (also because fixed-sized arrays have a buggy .in

Re: obj2asm

2010-03-08 Thread grauzone
Trass3r wrote: The linux version comes in the zip right along side dmd. Indeed. Even the OSX folder contains obj2asm. The windows version is missing. The best thing is, on Linux you can use binutils objdump just fine. I'm sure OSX has tools to inspect object files as well. Only on Windows,

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Steven Schveighoffer
On Mon, 08 Mar 2010 15:56:14 -0500, Andrei Alexandrescu wrote: Steven Schveighoffer wrote: On Mon, 08 Mar 2010 14:49:33 -0500, Andrei Alexandrescu wrote: bearophile wrote: Andrei Alexandrescu: Sorry, this stays. Then I'm not going to use the Phobos printing in all my future D2 prog

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread bearophile
> 2) What's the best way to translate this to the new operator regime? > > T foo(T)(T s) if (__traits(hasMember, T, "opAdd")) { > return s + s; > } I have not found a good solution yet. This solution looks buggy (also because fixed-sized arrays have a buggy .init): import std.stdio: writel

Re: obj2asm

2010-03-08 Thread Trass3r
> The linux version comes in the zip right along side dmd. > Indeed. Even the OSX folder contains obj2asm. The windows version is missing.

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Philippe Sigaud
On Mon, Mar 8, 2010 at 14:22, Steven Schveighoffer wrote: > The shrinkToFit name is not my favorite, anyone care to submit a better > name? minimize is out because it has connotations of math already. > minCapacity minimizeCapacity shrinkCapacity shrink (just shrink) releaseCapacity compacify fi

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Gareth Charnock
I think this bug has been squished as well. Both test cases now compile fine. http://d.puremagic.com/issues/show_bug.cgi?id=3694 Walter Bright wrote: Lots of meat and potatoes here, and a cookie! (spelling checker for error messages) http://www.digitalmars.com/d/1.0/changelog.html http://ftp.

Re: obj2asm

2010-03-08 Thread Adam D. Ruppe
On Mon, Mar 08, 2010 at 04:12:00PM -0500, Trass3r wrote: > Maybe because it's not free (and not much advertised). The linux version comes in the zip right along side dmd. -- Adam D. Ruppe http://arsdnet.net

Re: obj2asm

2010-03-08 Thread Trass3r
> obj2asm tells the tale. (obj2asm is an incredibly useful tool, I don't > know why nobody uses it.) > Maybe because it's not free (and not much advertised). obconv also supports disassembling various object file formats + conversion between them and it's open source: http://www.agner.org/optim

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Andrei Alexandrescu
Steven Schveighoffer wrote: On Mon, 08 Mar 2010 14:49:33 -0500, Andrei Alexandrescu wrote: bearophile wrote: Andrei Alexandrescu: Sorry, this stays. Then I'm not going to use the Phobos printing in all my future D2 programs. As I was not using it in D1. I'm not going to change idea on th

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread bearophile
Steven Schveighoffer: > For completely unambiguous, yes. But still, I find often that quotes are > more noise than they are worth when just doing simple printouts. What we > want is the most useful default. Quotes add a bit of noise, but I prefer to tell apart the cases of two strings from

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Steven Schveighoffer
On Mon, 08 Mar 2010 15:12:24 -0500, bearophile wrote: Steven Schveighoffer: Tell me how you would parse the following text serialization string for a string[]: hello world how are you What if it was a string[][]? Compare that to: [hello world, [how are, you]] You are missing somethin

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread bearophile
Andrei Alexandrescu: > Your choice of leading/trailing symbols and of separators makes 'to' > friendlier for printing e.g. debug strings. My choice makes it a > primitive for text serialization. I'm not 100% sure which is the more > frequent use and therefore which is the most appropriate as a d

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Walter Bright
Don wrote: Bug 1914 Array initialisation from const array yields memory trample was fixed, in D2 only. Can we get this into D1 as well? The problem is I don't think it's the right fix, and I haven't spent the time figuring it out yet.

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Walter Bright
bearophile wrote: Note: this produces the same very large binary, I don't know why: double[100_000] arr = void; static this() { arr[] = typeof(arr[0]).init; } void main() {} obj2asm tells the tale. (obj2asm is an incredibly useful tool, I don't know why nobody uses it.) double[100_00

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread bearophile
Steven Schveighoffer: > Tell me how you would parse the following text serialization string for a > string[]: > > hello world how are you > > What if it was a string[][]? > > Compare that to: > > [hello world, [how are, you]] You are missing something: ["hello world", ["how are", "you"]] :

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Walter Bright
bearophile wrote: While this hangs my compiler, I don't know why: double[100_000] arr = 0.0; static this() { arr[] = typeof(arr[0]).init; } void main() {} Well, it didn't hang, it just took a while. I found the problem.

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Steven Schveighoffer
On Mon, 08 Mar 2010 14:49:33 -0500, Andrei Alexandrescu wrote: bearophile wrote: Andrei Alexandrescu: Sorry, this stays. Then I'm not going to use the Phobos printing in all my future D2 programs. As I was not using it in D1. I'm not going to change idea on this. (e.g. the comma may be

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Lars T. Kyllingstad
Steven Schveighoffer wrote: On Mon, 08 Mar 2010 14:27:36 -0500, Andrei Alexandrescu wrote: bearophile wrote: Andrei Alexandrescu: $(LI std.conv: changed the default array formatting from "[a, b, c]" to "a b c") That's a regression!!! (And I think in the past it was [a,b,c] instead of

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Andrei Alexandrescu
bearophile wrote: Andrei Alexandrescu: Sorry, this stays. Then I'm not going to use the Phobos printing in all my future D2 programs. As I was not using it in D1. I'm not going to change idea on this. (e.g. the comma may be a decimal point in some languages, so is [1,2] in a German locale

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Andrei Alexandrescu
Steven Schveighoffer wrote: On Mon, 08 Mar 2010 14:27:36 -0500, Andrei Alexandrescu wrote: bearophile wrote: Andrei Alexandrescu: $(LI std.conv: changed the default array formatting from "[a, b, c]" to "a b c") That's a regression!!! (And I think in the past it was [a,b,c] instead of

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread bearophile
Andrei Alexandrescu: > Sorry, this stays. Then I'm not going to use the Phobos printing in all my future D2 programs. As I was not using it in D1. I'm not going to change idea on this. >(e.g. the comma may be a decimal point in some languages, so is [1,2] in a >German locale an array of doubl

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Steven Schveighoffer
On Mon, 08 Mar 2010 14:27:36 -0500, Andrei Alexandrescu wrote: bearophile wrote: Andrei Alexandrescu: $(LI std.conv: changed the default array formatting from "[a, b, c]" to "a b c") That's a regression!!! (And I think in the past it was [a,b,c] instead of [a, b, c], because it's bett

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread bearophile
If you compile a program like this: double[100_000] arr; void main() {} With dmd you produce a binary about 1 MB in size, because doubles in D are not filled with zero. So for n-D arrays bigger than a certain amount of memory, can DMD compile that code with a zero initialization plus filling o

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Andrei Alexandrescu
bearophile wrote: Andrei Alexandrescu: $(LI std.conv: changed the default array formatting from "[a, b, c]" to "a b c") That's a regression!!! (And I think in the past it was [a,b,c] instead of [a, b, c], because it's better to save some screen space, it costs a lot!). Sorry, this stays. T

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Don
Walter Bright wrote: Lots of meat and potatoes here, and a cookie! (spelling checker for error messages) http://www.digitalmars.com/d/1.0/changelog.html http://ftp.digitalmars.com/dmd.1.057.zip http://www.digitalmars.com/d/2.0/changelog.html http://ftp.digitalmars.com/dmd.2.041.zip Thanks to

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread bearophile
Andrei Alexandrescu: > $(LI std.conv: changed the default array formatting from "[a, b, c]" to > "a b c") That's a regression!!! (And I think in the past it was [a,b,c] instead of [a, b, c], because it's better to save some screen space, it costs a lot!). Bye, bearophile

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Andrei Alexandrescu
Walter Bright wrote: Lots of meat and potatoes here, and a cookie! (spelling checker for error messages) http://www.digitalmars.com/d/1.0/changelog.html http://ftp.digitalmars.com/dmd.1.057.zip http://www.digitalmars.com/d/2.0/changelog.html http://ftp.digitalmars.com/dmd.2.041.zip Thanks to

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Andrei Alexandrescu
Walter Bright wrote: Lots of meat and potatoes here, and a cookie! (spelling checker for error messages) http://www.digitalmars.com/d/1.0/changelog.html http://ftp.digitalmars.com/dmd.1.057.zip http://www.digitalmars.com/d/2.0/changelog.html http://ftp.digitalmars.com/dmd.2.041.zip Thanks to

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Adam Ruppe
> __traits allMembers and and derivedMembers now return a tuple of strings > rather > than an array of strings. Enclose __traits in [ ] to make array literal. This > makes it > possible for foreach statements to iterate at compile time over it. How exciting! On 3/8/10, Trass3r wrote: > Is ther

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Trass3r
Is there a better way to use the new operator overloading than string mixins? Also the following code strangely yields: dsfml\system\vector2.d(47): Error: variable dsfml.system.vector2.Vector2!(float).Vector2.op only parameters or foreach declarations can be ref /// element-wise operations, +,

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Ary Borenszweig
bearophile wrote: Ary Borenszweig: I'm normally interested to enter the if branch if x is not null and it has an interesting value. For example, if I implement a String class I would implement it as not being empty. But I think the biggest problem is making a different semantic for this to str

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread bearophile
Ary Borenszweig: > I'm normally interested to enter the if branch if x is not null and it > has an interesting value. For example, if I implement a String class I > would implement it as not being empty. But I think the biggest problem > is making a different semantic for this to structs and cla

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread bearophile
Ary Borenszweig: > And isn't it better for the spellchecker to show the closest match using > levenshtein distance instead of just distance 1? Walter is an engineer, and follows the KISS principle, he likes to use the simpler thing that can possibly work (especially in the first version of some

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Steven Schveighoffer
On Mon, 08 Mar 2010 01:54:12 -0500, Walter Bright wrote: Lots of meat and potatoes here, and a cookie! (spelling checker for error messages) http://www.digitalmars.com/d/1.0/changelog.html http://ftp.digitalmars.com/dmd.1.057.zip http://www.digitalmars.com/d/2.0/changelog.html http://ftp

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread bearophile
The Html of the change logs seems a bit wrong, the latest version now is at the top, and in the 2.0 changelog the "Bugs Fixed" are divided in two different horizontal alignments.

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Ary Borenszweig
Ary Borenszweig wrote: Walter Bright wrote: Lots of meat and potatoes here, and a cookie! (spelling checker for error messages) http://www.digitalmars.com/d/1.0/changelog.html http://ftp.digitalmars.com/dmd.1.057.zip http://www.digitalmars.com/d/2.0/changelog.html http://ftp.digitalmars.com/

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread bearophile
Walter Bright Wrote: > Lots of meat and potatoes here, and a cookie! (spelling checker for > error messages) Thank you for the cookie too :-) I will need some more time to try all the new things. In the meantime I have already two small questions: 1) What does "Implemented attributes for constr

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Ary Borenszweig
Walter Bright wrote: Lots of meat and potatoes here, and a cookie! (spelling checker for error messages) http://www.digitalmars.com/d/1.0/changelog.html http://ftp.digitalmars.com/dmd.1.057.zip http://www.digitalmars.com/d/2.0/changelog.html http://ftp.digitalmars.com/dmd.2.041.zip Thanks to

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Steven Schveighoffer
On Mon, 08 Mar 2010 03:45:21 -0500, Lars T. Kyllingstad wrote: Simen kjaeraas wrote: Walter Bright wrote: Lots of meat and potatoes here, and a cookie! (spelling checker for error messages) http://www.digitalmars.com/d/1.0/changelog.html http://ftp.digitalmars.com/dmd.1.057.zip http:

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Denis Koroskin
On Mon, 08 Mar 2010 09:54:12 +0300, Walter Bright wrote: Lots of meat and potatoes here, and a cookie! (spelling checker for error messages) http://www.digitalmars.com/d/1.0/changelog.html http://ftp.digitalmars.com/dmd.1.057.zip http://www.digitalmars.com/d/2.0/changelog.html http://ftp

Re: DSFML2

2010-03-08 Thread Trass3r
> C:\Jpro\dpro\small>xfbuild xft.d > Thread 1: compiling 1 modules > Thread 0: compiling 0 modules > Error: unrecognized switch '-deps=xft.moduleDeps' > Build failed: "dmd @xfbuild.1660e00.rsp" returned 1 > Yeah it still has its quirks. Feel free to contact the authors/file an issue/etc.

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Lars T. Kyllingstad
Walter Bright wrote: Lots of meat and potatoes here, and a cookie! (spelling checker for error messages) http://www.digitalmars.com/d/1.0/changelog.html http://ftp.digitalmars.com/dmd.1.057.zip http://www.digitalmars.com/d/2.0/changelog.html http://ftp.digitalmars.com/dmd.2.041.zip Thanks to

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Lars T. Kyllingstad
Simen kjaeraas wrote: Walter Bright wrote: Lots of meat and potatoes here, and a cookie! (spelling checker for error messages) http://www.digitalmars.com/d/1.0/changelog.html http://ftp.digitalmars.com/dmd.1.057.zip http://www.digitalmars.com/d/2.0/changelog.html http://ftp.digitalmars.com

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Simen kjaeraas
Walter Bright wrote: Lots of meat and potatoes here, and a cookie! (spelling checker for error messages) http://www.digitalmars.com/d/1.0/changelog.html http://ftp.digitalmars.com/dmd.1.057.zip http://www.digitalmars.com/d/2.0/changelog.html http://ftp.digitalmars.com/dmd.2.041.zip Thanks

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Lars T. Kyllingstad
Walter Bright wrote: Lots of meat and potatoes here, and a cookie! (spelling checker for error messages) http://www.digitalmars.com/d/1.0/changelog.html http://ftp.digitalmars.com/dmd.1.057.zip http://www.digitalmars.com/d/2.0/changelog.html http://ftp.digitalmars.com/dmd.2.041.zip Thanks to

Re: dmd 1.057 and 2.041 release

2010-03-08 Thread Lutger
Thanks! A pleasant surprise to see interface contracts.