Dispatching from receive to a function

Philippe Sigaud philippe.sigaud at gmail.com
Mon Sep 27 14:19:31 PDT 2010


On Mon, Sep 27, 2010 at 21:49, Juanjo Alvarez <
juanjux at 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"] part than
the Variant(&c.test) part.


> Yep, variants are cool. You could even use an struct as value type of the
> associative array and store the variant in one member and the signature
> of the delegate, as string, in another member. The you could use a mixin
> in the receiver to extract the delegate without knowing the original
> signature.
>
> All this is  wonderfully disturbing to me :)
>

I'm not sure you can. You can only mixin strings known at compile-time. Your
string member will only have a value at runtime.
Except if the struct is an enum, maybe.


Philippe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20100927/0fd40361/attachment.html>


More information about the Digitalmars-d-learn mailing list