Re: Dispatching from receive to a function

2010-09-27 Thread Philippe Sigaud
On Mon, Sep 27, 2010 at 21:49, Juanjo Alvarez < juan...@thatwebmailofgoogleproperty.com> wrote: > >> Curiously if you create holder like this, it will give an > >> arrayoutofbound error at runtime, I don't know if that is a bug: > I think I got this one too. IIRC, it's a bug in the holder["test"]

Re: Dispatching from receive to a function

2010-09-27 Thread Bob Cowdery
Thanks for the suggestions. I'm still hankering after an elegant solution to the receive rather than try to patch it up after the event. The best I can come up with is pretty ugly (odd) at the front but looks better at the back-end. Maybe someone can refine it a bit. struct RATE{}; struct SRC_1{

Re: Dispatching from receive to a function

2010-09-27 Thread Juanjo Alvarez
On Mon, 27 Sep 2010 21:00:48 +0200, Johannes Pfau wrote: > On 27.09.2010 20:46, Juanjo Alvarez wrote: >> I'm new to the language so I don't know if this is horribly wrong on >> some levels, but it works: >> >> - >> >> import std.variant; >> import std.stdio; >> >> cl

Re: Dispatching from receive to a function

2010-09-27 Thread Johannes Pfau
On 27.09.2010 20:46, Juanjo Alvarez wrote: > I'm new to the language so I don't know if this is horribly wrong on some > levels, but it works: > > - > > import std.variant; > import std.stdio; > > class C > { > bool test(int i, char c) { writeln("Hello from test1

Re: Dispatching from receive to a function

2010-09-27 Thread Juanjo Alvarez
I'm new to the language so I don't know if this is horribly wrong on some levels, but it works: - import std.variant; import std.stdio; class C { bool test(int i, char c) { writeln("Hello from test1"); return true; } void test2(string v) { writeln("Hello from

Re: Dispatching from receive to a function

2010-09-27 Thread Johannes Pfau
On 27.09.2010 15:36, Bob Cowdery wrote: > Thanks. Do you know if the signature is a mandatory part. If I left the > signature out would it then only work with a delegate with no > parameters? If so I think I'm in the same state as my delegates will not > all have the same signature. > Yep, the s

Re: Dispatching from receive to a function

2010-09-27 Thread Bob Cowdery
Thanks. Do you know if the signature is a mandatory part. If I left the signature out would it then only work with a delegate with no parameters? If so I think I'm in the same state as my delegates will not all have the same signature. Bob On 27/09/2010 14:21, Johannes Pfau wrote: > On 27.09.201

Re: Dispatching from receive to a function

2010-09-27 Thread Johannes Pfau
On 27.09.2010 15:07, Bob Cowdery wrote: > > Failing that I think a dispatcher structure using an associative array > would be my next choice. However I'm getting stuck on how to define and > use an array which maps a string key to a delegate. Can someone help me > out there please. I will then eff