Re: Array initialization quiz

2011-11-28 Thread Andrej Mitrovic
On 11/29/11, bearophile wrote: > Do you know why the compiler doesn't ask you for a cast, and why the run > does that? Because foreach is broken? http://d.puremagic.com/issues/show_bug.cgi?id=4510

Re: Array initialization quiz

2011-11-28 Thread bearophile
Andrej Mitrovic: > Err no? Running after compilation goes into an infinite loop on 2.056. Silly, this is a quiz, you need to try to answer without compiling it first :-) Do you know why the compiler doesn't ask you for a cast, and why the run does that? Bye, bearophile

Re: Array initialization quiz

2011-11-28 Thread Andrej Mitrovic
Err no? Running after compilation goes into an infinite loop on 2.056.

Re: Array initialization quiz

2011-11-28 Thread bearophile
Andrej Mitrovic: > I get an infinite loop. :s In your brain, really? Is that dangerous? Bye, bearophile

Re: Array initialization quiz

2011-11-28 Thread Andrej Mitrovic
I get an infinite loop. :s

Array initialization quiz

2011-11-28 Thread bearophile
A little D2 quiz, of course. This was discussed some time ago, but repeating now and then such things doesn't hurt in D.learn. Do you think this little program compiles? Or do you think the D2 compiler will refuse to compile it and ask you for a cast from int -> ubyte? If this compiles (maybe b

Re: How do I redirect stderr of a spawned process into an internal buffer?

2011-11-28 Thread Andrej Mitrovic
Btw, is the new std.process hosted anywhere? My solution is windows-specific and probably doesn't handle all the edge-cases. Even if the new std.process isn't ready yet I'd love to look at your implementation.

Re: How do I redirect stderr of a spawned process into an internal buffer?

2011-11-28 Thread Andrej Mitrovic
Cool stuff Steve, I'll be eager to review it when the time comes.

Re: References

2011-11-28 Thread Graham Fawcett
On Mon, 28 Nov 2011 17:41:08 -0800, David Currie wrote: > I am a newbie to D. From (C++,Java,others...) background. > > In C++ I can say > > void f1(int& pInt) > { >pInt = 1; > } > > which sets pInt(which is outside f1) > because although pInt (at compile time) is a Value in reality it is >

Re: Overhead of synchronized class used in unshared situation

2011-11-28 Thread Timon Gehr
On 11/28/2011 07:37 AM, breezes wrote: Thanks. It seems that I have to write two classes, one synchronized and one is not. Of course the synchronized one should be the wrapper. However, all members of a synchronized class are also shared. So I can not use the un-synchronized class in the synch

Re: What about sets?

2011-11-28 Thread Jonathan M Davis
On Monday, November 28, 2011 12:09:45 Andrea Fontana wrote: > Thank you! I didn't check for "std.container" module :) I should warn you that std.container a bit sparse at the moment, but RedBlackTree does give you a set (or a sorted map with the appropriate comparator function). - Jonathan M Da

Re: How do I redirect stderr of a spawned process into an internal buffer?

2011-11-28 Thread Steven Schveighoffer
On Sun, 27 Nov 2011 17:37:24 -0500, Andrej Mitrovic wrote: I've talked about this before, there's a problem with spawning multiple processes and letting them write to stderr asynchronously It seems like this might be a Windows-only problem, I couldn't recreate on Ubuntu but maybe that's becau

Re: dup method const or not?

2011-11-28 Thread Steven Schveighoffer
On Sun, 27 Nov 2011 16:52:56 -0500, Matthias Walter wrote: Hi, Recently, I realized that several "dup" methods in D2's phobos are declared like the one for BitArray: @property BitArray dup() My question is why it is declared without "const"? Is it a bug or is there a reason for it? I can t

Re: [OT] news group test

2011-11-28 Thread Marco Leise

Re: What about sets?

2011-11-28 Thread Andrea Fontana
Thank you! I didn't check for "std.container" module :) Il giorno lun, 28/11/2011 alle 02.55 -0800, Jonathan M Davis ha scritto: > On Monday, November 28, 2011 11:48:28 Andrea Fontana wrote: > > In c++ there are a lot of data structs (vector, hashmap, ...) defined by > > stl. I need something sim

Re: dup method const or not?

2011-11-28 Thread mta`chrono
Okay, what about this hack? --- import std.bitmanip; import core.stdc.string; void main() { const(BitArray) foo; BitArray bar; bar.len = foo.len; bar.ptr = foo.ptr[0 .. foo.dim].dup.ptr; } ---

Re: What about sets?

2011-11-28 Thread Jonathan M Davis
On Monday, November 28, 2011 11:48:28 Andrea Fontana wrote: > In c++ there are a lot of data structs (vector, hashmap, ...) defined by > stl. I need something similar to c++ "set" in D. Does it exists? > I don't care about order of items, but I need a fast search and a easy > way to iterate. A tree

What about sets?

2011-11-28 Thread Andrea Fontana
In c++ there are a lot of data structs (vector, hashmap, ...) defined by stl. I need something similar to c++ "set" in D. Does it exists? I don't care about order of items, but I need a fast search and a easy way to iterate. A tree-like struct...