On Tuesday, 11 July 2017 at 17:20:33 UTC, Ali Çehreli wrote:
@Virtual("t", "d", "w")
string fight(Character t, Dragon d, Hands w) {
return "you just killed a dragon with your bare hands.
Incredible isn't it?";
[...]
mixin ProcessMethods();
Great suggestion! I think this could work:
string fight(virtual!Character, virtual!Creature,
virtual!Device); // declares method
// define implemention:
string fight(Character t, Dragon d, Hands w);
mixin ProcessMethods();
How do you find the current module inside ProcessMethods?
There's a problem with the catch-all method though:
string fight(Character a, Creature b, Device c) { }
This won't work because string fight(Character a, Creature b,
Device c) is the method itself - it's generated by the library.
We'll have to come up with a special syntax for it.
J-L