Cannot dup an associative array but why?
Ali Çehreli via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Jul 11 10:20:33 PDT 2017
On 07/10/2017 04:24 PM, Jean-Louis Leroy wrote:
> FYI, having a lot of fun. See
>
https://github.com/jll63/meth.d/blob/experiments/source/meth/examples/adventure.d
I'm glad you're trying out multi-methods with D:
https://github.com/jll63/meth.d/tree/experiments
That's some serious code you've written there and you must be happy that
'virtual' is not a keyword in D. ;)
Maybe others can come up with ideas on a better syntax. Just to get the
conversation going and without thinking it through, how about something
like the following?
struct Virtual(Args...) {
// ...
}
@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?";
}
Then, something like the following which would parse the module to do
its magic:
mixin ProcessMethods();
// Can include 'static this()' for runtime initialization if necessary
Again though, this is just a thought about making the syntax more
fluent. More for the others to think about it for me. :)
Ali
More information about the Digitalmars-d-learn
mailing list