onDispatch demo not compiling

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Aug 20 23:31:45 PDT 2014


On Thu, 21 Aug 2014 05:39:14 +0000
Shachar via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com>
wrote:

that's it: failing to evaluate opDispatch() template is not a
compilation error. compiler will silently try to find direct method if
opDispatch() fails. so be very careful with it.

you can add pragma(msg, "...") to your opDispatch to see if it really
compiles without errors. i.e.

  auto onDispatch(string m, Args...)(Args args) {
    pragma(msg, "m="~m);
    enum t = underscoresToCamelCase(t);
    pragma(msg, "t="~t);
    return mixin("this."~t~"(args)");
 }

you should see output of this pragmas in compile-time. if you can't see
"t", for example, it means that evaluation of underscoresToCamelCase()
failed.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20140821/b3d18f7d/attachment.sig>


More information about the Digitalmars-d-learn mailing list