//Consider this:
import std.stdio;
void main() {
X obj = new Y;
writeln( obj._f() );
}
class Proxy {
X x;
this(X x) { this.x = x; }
string _f() { return "Proxy._f called"; }
}
class X {
auto opDispatch(string f, Args...)(Args args) {
Proxy p = new Proxy(this);
On Thursday, 15 November 2018 at 17:14:21 UTC, Carl Sturtivant
wrote:
opDispatch is special in that it allows for functions to be
added to a class or struct when undefined overtly but used
elsewhere but it seems those functions sadly are final.
Right, all templates are final, including opDispa
On Thursday, 15 November 2018 at 18:04:42 UTC, Adam D. Ruppe
wrote:
Right, all templates are final, including opDispatch.
What I've done in the past is to forward them to a virtual
function with runtime arguments instead of compile time
arguments.
Kinda like:
void opDispatch(string name)()
On 11/15/2018 09:14 AM, Carl Sturtivant wrote:
> opDispatch is special in that it allows for functions to be added to a
> class or struct when undefined overtly but used elsewhere but it seems
> those functions sadly are final.
>
> Can anything useful be done to remedy the situation?
For the com
On Thursday, 15 November 2018 at 19:01:45 UTC, Ali Çehreli wrote:
On 11/15/2018 09:14 AM, Carl Sturtivant wrote:
> opDispatch is special in that it allows for functions to be
added to a
> class or struct when undefined overtly but used elsewhere but
it seems
> those functions sadly are final.
>
On Saturday, November 17, 2018 11:09:51 PM MST Carl Sturtivant via
Digitalmars-d-learn wrote:
> On Thursday, 15 November 2018 at 19:01:45 UTC, Ali Çehreli wrote:
> > On 11/15/2018 09:14 AM, Carl Sturtivant wrote:
> > > opDispatch is special in that it allows for functions to be
> >
> > added to a