Re: mixin on identifier

2011-11-30 Thread Johannes Totz
On 22/11/2011 21:11, Philippe Sigaud wrote: Hi there, template recursion can get difficult to write sometimes. For the mixin part, since what you're doing is looping on States, another solution is to use string mixins: string stateCode(States...)() { string code; foreach(state;

Re: mixin on identifier

2011-11-30 Thread Johannes Totz
On 22/11/2011 21:11, Philippe Sigaud wrote: Hi there, template recursion can get difficult to write sometimes. For the mixin part, since what you're doing is looping on States, another solution is to use string mixins: string stateCode(States...)() { string code; foreach(state;

Re: Array initialization quiz

2011-11-30 Thread Steven Schveighoffer
On Tue, 29 Nov 2011 15:06:11 -0500, Jonathan M Davis jmdavisp...@gmx.com wrote: On Tuesday, November 29, 2011 20:42:59 Marco Leise wrote: Am 29.11.2011, 20:41 Uhr, schrieb Marco Leise marco.le...@gmx.de: Am 29.11.2011, 14:53 Uhr, schrieb bearophile bearophileh...@lycos.com: deadalnix:

Re: Array initialization quiz

2011-11-30 Thread Xinok
On 11/30/2011 7:50 AM, Steven Schveighoffer wrote: On Tue, 29 Nov 2011 15:06:11 -0500, Jonathan M Davis jmdavisp...@gmx.com wrote: The type of the index should be irrelavent to the underlying loop mechanism. Note that the issue is really that foreach(T i, val; arr) {...} translates to for(T i

Re: Array initialization quiz

2011-11-30 Thread Steven Schveighoffer
On Wed, 30 Nov 2011 10:54:11 -0500, Xinok xi...@live.com wrote: On 11/30/2011 7:50 AM, Steven Schveighoffer wrote: On Tue, 29 Nov 2011 15:06:11 -0500, Jonathan M Davis jmdavisp...@gmx.com wrote: The type of the index should be irrelavent to the underlying loop mechanism. Note that the issue

Re: Array initialization quiz

2011-11-30 Thread Xinok
On 11/30/2011 11:46 AM, Steven Schveighoffer wrote: On Wed, 30 Nov 2011 10:54:11 -0500, Xinok xi...@live.com wrote: On 11/30/2011 7:50 AM, Steven Schveighoffer wrote: On Tue, 29 Nov 2011 15:06:11 -0500, Jonathan M Davis jmdavisp...@gmx.com wrote: The type of the index should be irrelavent to

idea for variant improvement

2011-11-30 Thread bioinfornatics
Variant is very usefull but a function who take a variant as parameter do not works whithout a cast. but You can assign a value form any type in statement Variant v = 2u. the code below explain well the problem --- import std.string; import std.stdio; import std.variant; void func(

Re: Array initialization quiz

2011-11-30 Thread Ali Çehreli
On 11/30/2011 10:17 AM, Xinok wrote: On 11/30/2011 11:46 AM, Steven Schveighoffer wrote: foreach(_i; ubyte.min..ubyte.max + 1){ ubyte i = cast(ubyte)_i; } But my point was, foreach over a range gives me all the elements in a range, regardless of how the underlying loop is constructed. The

Re: Array initialization quiz

2011-11-30 Thread Andrej Mitrovic
On 11/30/11, Steven Schveighoffer schvei...@yahoo.com wrote: I remember at one point there was someone who had actual code that resulted in a loop for ubytes, or was trying to figure out how to foreach over all possible ubyte values. Instant flashback, I think it was this:

Re: idea for variant improvement

2011-11-30 Thread Timon Gehr
On 11/30/2011 07:53 PM, bioinfornatics wrote: Variant is very usefull but a function who take a variant as parameter do not works whithout a cast. but You can assign a value form any type in statement Variant v = 2u. the code below explain well the problem --- import std.string;

Re: idea for variant improvement

2011-11-30 Thread bioinfornatics
Le mercredi 30 novembre 2011 à 22:19 +0100, Timon Gehr a écrit : On 11/30/2011 07:53 PM, bioinfornatics wrote: Variant is very usefull but a function who take a variant as parameter do not works whithout a cast. but You can assign a value form any type in statement Variant v = 2u. the

Re: Make a variable single-assignment?

2011-11-30 Thread Stewart Gordon
On 21/11/2011 20:06, Jesse Phillips wrote: What you are describing is Head Const, and is not available. http://www.d-programming-language.org/const-faq.html#head-const It will not be added as it doesn't provide any guarantees about the code that is useful to the compiler. It can't be added to

Re: idea for variant improvement

2011-11-30 Thread Timon Gehr
On 11/30/2011 11:55 PM, bioinfornatics wrote: Le mercredi 30 novembre 2011 à 22:19 +0100, Timon Gehr a écrit : On 11/30/2011 07:53 PM, bioinfornatics wrote: Variant is very usefull but a function who take a variant as parameter do not works whithout a cast. but You can assign a value form any

Re: Make a variable single-assignment?

2011-11-30 Thread Timon Gehr
On 12/01/2011 12:08 AM, Stewart Gordon wrote: On 21/11/2011 20:06, Jesse Phillips wrote: What you are describing is Head Const, and is not available. http://www.d-programming-language.org/const-faq.html#head-const It will not be added as it doesn't provide any guarantees about the code that

piping processes

2011-11-30 Thread NMS
Is there a cross-platform way to create a new process and get its i/o streams? Like java.lang.Process?

Concurrency Read/Write and Pure

2011-11-30 Thread Adam
Howdy. So, I'm reading through The D Programming Language book, and I had some questions on concurrency in D, and maybe with some emphasis on programming in general. I present my question with a hypothetical case: I have two threads and, ideally, one structure. The structure is large enough

Re: Concurrency Read/Write and Pure

2011-11-30 Thread Jonathan M Davis
On Thursday, December 01, 2011 04:23:39 Adam wrote: Howdy. So, I'm reading through The D Programming Language book, and I had some questions on concurrency in D, and maybe with some emphasis on programming in general. I present my question with a hypothetical case: I have two threads