Re: Using objects that manage threads via std.concurrency

2013-02-11 Thread Jonathan M Davis
On Tuesday, February 12, 2013 07:58:04 monarch_dodra wrote: > How can I get my 3 managers to co-exist, when they are all > sharing the same box? How can I make sure the workers are sending > their messages to the correct manager? By making it so that their receiving functions take unique types. If

Re: Using objects that manage threads via std.concurrency

2013-02-11 Thread monarch_dodra
On Tuesday, 12 February 2013 at 06:29:22 UTC, Ali Çehreli wrote: On 02/11/2013 01:37 PM, monarch_dodra wrote: > What should a manager do if it > calls "receive", and notices the message wasn't meant for him? Threads receive their own messages. If there is a specific receiver of a message, then

Re: Using objects that manage threads via std.concurrency

2013-02-11 Thread monarch_dodra
On Tuesday, 12 February 2013 at 00:09:40 UTC, FG wrote: On 2013-02-11 22:37, monarch_dodra wrote: Basically, I can't help but feel the thing has an hopelessly thread-global "mailbox" approach to the problem. This is all fine and dandy if there is only a single "canal" of communication between t

Re: Using objects that manage threads via std.concurrency

2013-02-11 Thread Ali Çehreli
On 02/11/2013 01:37 PM, monarch_dodra wrote: > What should a manager do if it > calls "receive", and notices the message wasn't meant for him? Threads receive their own messages. If there is a specific receiver of a message, then the child sends it to that receiver. As FG said, every thread ha

Re: A little of coordination for Rosettacode

2013-02-11 Thread bearophile
Jos van Uden: I have the rcrpg working, but I want to test it some more. Good. Adding a bit of unittesting is acceptable, I think. I'm not very happy with the alias function, it accepts just about any input, it can put the program in an invalid state. I presume this is a design bug share

Re: A little of coordination for Rosettacode

2013-02-11 Thread Jos van Uden
On 10-2-2013 1:57, bearophile wrote: ... Partial translation of rcrpg-Python: http://codepad.org/SflrKqbT I have the rcrpg working, but I want to test it some more. I'm not very happy with the alias function, it accepts just about any input, it can put the program in an invalid state. There w

Re: Using objects that manage threads via std.concurrency

2013-02-11 Thread FG
On 2013-02-11 22:37, monarch_dodra wrote: Basically, I can't help but feel the thing has an hopelessly thread-global "mailbox" approach to the problem. This is all fine and dandy if there is only a single "canal" of communication between the master and the child/children. What thread-global? Ev

Using objects that manage threads via std.concurrency

2013-02-11 Thread monarch_dodra
I've been trying out std.concurrency, and it's MPI, and found it very easy to use. It has been working well in most of my toy programs so far, but I see a HUGE glaring flaw with it. I mean: SHOWSTOPPER. Basically, I can't help but feel the thing has an hopelessly thread-global "mailbox" appro

Re: Idiomatic way to process const/immutable arrays as ranges

2013-02-11 Thread Steven Schveighoffer
On Mon, 11 Feb 2013 14:56:29 -0500, Steven Schveighoffer wrote: On Mon, 11 Feb 2013 14:52:51 -0500, Steven Schveighoffer wrote: With that change, then you can compile my original suggestion, or my later suggestion. Actually, it seems that even args.join(" ") works, without changing t

Re: Idiomatic way to process const/immutable arrays as ranges

2013-02-11 Thread Jonathan M Davis
On Monday, February 11, 2013 14:56:29 Steven Schveighoffer wrote: > On Mon, 11 Feb 2013 14:52:51 -0500, Steven Schveighoffer > > wrote: > > With that change, then you can compile my original suggestion, or my > > later suggestion. > > Actually, it seems that even args.join(" ") works, without ch

Re: Idiomatic way to process const/immutable arrays as ranges

2013-02-11 Thread Steven Schveighoffer
On Mon, 11 Feb 2013 14:52:51 -0500, Steven Schveighoffer wrote: With that change, then you can compile my original suggestion, or my later suggestion. Actually, it seems that even args.join(" ") works, without changing to the tail-const type... That is technically correct, but I'm not

Re: Idiomatic way to process const/immutable arrays as ranges

2013-02-11 Thread Steven Schveighoffer
On Mon, 11 Feb 2013 13:59:41 -0500, Dicebot wrote: Ye, looks like this is the root of problem, I tweaked at a bit and have come to the same conclusion :( Sad, I really hoped I simply have overlooked some common idiom. This is a bug, joinImpl compiles with the given type, it's just join tha

Re: Idiomatic way to process const/immutable arrays as ranges

2013-02-11 Thread Dicebot
Ye, looks like this is the root of problem, I tweaked at a bit and have come to the same conclusion :( Sad, I really hoped I simply have overlooked some common idiom.

Re: Idiomatic way to process const/immutable arrays as ranges

2013-02-11 Thread Dicebot
I know all of this. When I speak about "original" array, I mean function parameter itself, not one passed to function. Actually, nevermind, Jonathan has kind of answered my question.

Re: Idiomatic way to process const/immutable arrays as ranges

2013-02-11 Thread Regan Heath
On Mon, 11 Feb 2013 17:13:21 -, Dicebot wrote: On Monday, 11 February 2013 at 16:54:04 UTC, Jonathan M Davis wrote: The const(T)[] cannot alter the original array at all, so I concur with Steven in that the complaints about not wanting to use tail-const make no sense. Maybe this articl

Re: Idiomatic way to process const/immutable arrays as ranges

2013-02-11 Thread Steven Schveighoffer
On Mon, 11 Feb 2013 12:01:53 -0500, Dicebot wrote: On Monday, 11 February 2013 at 16:35:22 UTC, Steven Schveighoffer wrote: in means "const scope". scope is a no-op, const makes the array const, including the pointer length. const(T)[] means, the ELEMENTS are const, but the pointer and len

Re: Idiomatic way to process const/immutable arrays as ranges

2013-02-11 Thread Jonathan M Davis
On Monday, February 11, 2013 18:01:53 Dicebot wrote: > On Monday, 11 February 2013 at 16:35:22 UTC, Steven Schveighoffer > > wrote: > > in means "const scope". scope is a no-op, const makes the > > array const, including the pointer length. > > > > const(T)[] means, the ELEMENTS are const, but th

Re: Idiomatic way to process const/immutable arrays as ranges

2013-02-11 Thread Dicebot
On Monday, 11 February 2013 at 16:53:53 UTC, Jonathan M Davis wrote: On Monday, February 11, 2013 17:42:13 Dicebot wrote: On Monday, 11 February 2013 at 16:25:35 UTC, Dmitry Olshansky wrote: > I might be wrong but you can slice it e.g.: > > args[].join(" "); [], as well as [0.$] does return

Re: Idiomatic way to process const/immutable arrays as ranges

2013-02-11 Thread Dicebot
On Monday, 11 February 2013 at 16:54:04 UTC, Jonathan M Davis wrote: The const(T)[] cannot alter the original array at all, so I concur with Steven in that the complaints about not wanting to use tail-const make no sense. Maybe this article will help clear things up: And I exactly want to pro

Re: Idiomatic way to process const/immutable arrays as ranges

2013-02-11 Thread Dicebot
On Monday, 11 February 2013 at 16:35:22 UTC, Steven Schveighoffer wrote: in means "const scope". scope is a no-op, const makes the array const, including the pointer length. const(T)[] means, the ELEMENTS are const, but the pointer and length can be changed. This makes it a valid input range

Re: Idiomatic way to process const/immutable arrays as ranges

2013-02-11 Thread Jonathan M Davis
On Monday, February 11, 2013 11:35:22 Steven Schveighoffer wrote: > in means "const scope". scope is a no-op, const makes the array const, > including the pointer length. I would point out that that may change in the future. scope is supposed to stop references escaping in general but is only par

Re: Idiomatic way to process const/immutable arrays as ranges

2013-02-11 Thread Jonathan M Davis
On Monday, February 11, 2013 17:42:13 Dicebot wrote: > On Monday, 11 February 2013 at 16:25:35 UTC, Dmitry Olshansky > > wrote: > > I might be wrong but you can slice it e.g.: > > > > args[].join(" "); > > [], as well as [0.$] does return the very same qualified slice, > have tried it. For arra

Re: Idiomatic way to process const/immutable arrays as ranges

2013-02-11 Thread Dicebot
On Monday, 11 February 2013 at 16:25:35 UTC, Dmitry Olshansky wrote: I might be wrong but you can slice it e.g.: args[].join(" "); [], as well as [0.$] does return the very same qualified slice, have tried it.

Re: Idiomatic way to process const/immutable arrays as ranges

2013-02-11 Thread Steven Schveighoffer
On Mon, 11 Feb 2013 10:26:40 -0500, Dicebot wrote: On Monday, 11 February 2013 at 15:06:26 UTC, Steven Schveighoffer wrote: On Mon, 11 Feb 2013 09:46:54 -0500, Dicebot wrote: This question is so stupid I am just struck with trying to chose the "good" solution. Consider this code: stri

Re: Idiomatic way to process const/immutable arrays as ranges

2013-02-11 Thread Dmitry Olshansky
11-Feb-2013 18:46, Dicebot пишет: This question is so stupid I am just struck with trying to chose the "good" solution. Consider this code: string func(in string[] args) { return args.join(" "); // compile error, args is not an input range } I might be wrong but you can slice it e.g.: a

Re: For DLLs, what does export actually do?

2013-02-11 Thread Regan Heath
On Sun, 10 Feb 2013 12:36:38 -, Ben Davis wrote: On 10/02/2013 08:17, Benjamin Thaut wrote: Am 10.02.2013 03:03, schrieb Ben Davis: My functions are "export extern (Windows)" - I think they're global...? For example: export extern(Windows) LRESULT DriverProc(DWORD_PTR dwDriverId, HDRVR

Re: Idiomatic way to process const/immutable arrays as ranges

2013-02-11 Thread bearophile
Dicebot: string func(in string[] args) { return args.join(" "); // compile error, args is not an input range } join() should to able to join a const array of strings. Bye, bearophile

Re: Idiomatic way to process const/immutable arrays as ranges

2013-02-11 Thread Dicebot
On Monday, 11 February 2013 at 14:53:17 UTC, Namespace wrote: On Monday, 11 February 2013 at 14:46:55 UTC, Dicebot wrote: This question is so stupid I am just struck with trying to chose the "good" solution. Consider this code: string func(in string[] args) { return args.join(" "); // comp

Re: Idiomatic way to process const/immutable arrays as ranges

2013-02-11 Thread Dicebot
On Monday, 11 February 2013 at 15:06:26 UTC, Steven Schveighoffer wrote: On Mon, 11 Feb 2013 09:46:54 -0500, Dicebot wrote: This question is so stupid I am just struck with trying to chose the "good" solution. Consider this code: string func(in string[] args) { return args.join(" "); /

Re: Idiomatic way to process const/immutable arrays as ranges

2013-02-11 Thread Steven Schveighoffer
On Mon, 11 Feb 2013 09:46:54 -0500, Dicebot wrote: This question is so stupid I am just struck with trying to chose the "good" solution. Consider this code: string func(in string[] args) { return args.join(" "); // compile error, args is not an input range } It is somewhat expected as

Re: Idiomatic way to process const/immutable arrays as ranges

2013-02-11 Thread Namespace
On Monday, 11 February 2013 at 14:46:55 UTC, Dicebot wrote: This question is so stupid I am just struck with trying to chose the "good" solution. Consider this code: string func(in string[] args) { return args.join(" "); // compile error, args is not an input range } It is somewhat expe

Idiomatic way to process const/immutable arrays as ranges

2013-02-11 Thread Dicebot
This question is so stupid I am just struck with trying to chose the "good" solution. Consider this code: string func(in string[] args) { return args.join(" "); // compile error, args is not an input range } It is somewhat expected as you can hardly popFront on a const range. But then q