http://d.puremagic.com/issues/show_bug.cgi?id=6434


Max Samukha <samu...@voliacable.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |samu...@voliacable.com


--- Comment #2 from Max Samukha <samu...@voliacable.com> 2011-08-16 02:39:02 
PDT ---
I am not sure. opDispatch is meant to be a fallback mechanism used after all
regular lookups fail. For example, one intended use of opDispatch is to
dynamically handle calls to members unavailable statically. With "alias this"
given the lowest priority, one would need to manually forward calls to
inherited members:

struct A
{
   Variant i;
   alias i this;

   auto opDispatch(string name, A...)(auto ref A args)
   {
       static if (isCallableOnI!(name, A)))
           mixin("return i." ~ name ~ "(args);"); // this shouldn't be
necessary
       else
           return dispatchDynamically(name, toVariants(args));                 
   }
}

So the bug is in opDispatch not being considered after "alias this" lookup
fails, and not in the order of lookups.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to