Re: Cannot dup an associative array but why?

2017-07-12 Thread Jean-Louis Leroy via Digitalmars-d-learn
On Tuesday, 11 July 2017 at 21:23:28 UTC, Ali Çehreli wrote: Default template and function arguments are resolved at instantiation site, which means __MODULE__ would resolve automatically to the caller's module. For example, if you have this module: __MODULE__ is a string so I cannot pass it

Re: Cannot dup an associative array but why?

2017-07-11 Thread Ali Çehreli via Digitalmars-d-learn
On 07/11/2017 01:25 PM, Jean-Louis Leroy wrote: > 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 Pr

Re: Cannot dup an associative array but why?

2017-07-11 Thread Jean-Louis Leroy via Digitalmars-d-learn
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: st

Re: Cannot dup an associative array but why?

2017-07-11 Thread Jean-Louis Leroy via Digitalmars-d-learn
On Tuesday, 11 July 2017 at 17:20:33 UTC, Ali Çehreli wrote: That's some serious code you've written there and you must be happy that 'virtual' is not a keyword in D. ;) Thanks. Haha I would have used virtual_ like I did in C++ ;-) Maybe others can come up with ideas on a better syntax. Wh

Re: Cannot dup an associative array but why?

2017-07-11 Thread Ali Çehreli via Digitalmars-d-learn
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

Re: Cannot dup an associative array but why?

2017-07-10 Thread Jean-Louis Leroy via Digitalmars-d-learn
On Monday, 10 July 2017 at 19:11:37 UTC, Ali Çehreli wrote: On 07/10/2017 11:46 AM, Jean-Louis Leroy wrote: > Is there something special about ClassInfo that confuses? Look at this > example: > > struct Foo > { > > } > > class Bar > { > } > > void main() > { > Foo*[Bar] a; > auto aa = a.dup;

Re: Cannot dup an associative array but why?

2017-07-10 Thread Ali Çehreli via Digitalmars-d-learn
On 07/10/2017 11:46 AM, Jean-Louis Leroy wrote: > Is there something special about ClassInfo that confuses? Look at this > example: > > struct Foo > { > > } > > class Bar > { > } > > void main() > { > Foo*[Bar] a; > auto aa = a.dup; // OK > Foo*[ClassInfo] b; // Error: static assert "cannot

Cannot dup an associative array but why?

2017-07-10 Thread Jean-Louis Leroy via Digitalmars-d-learn
Is there something special about ClassInfo that confuses? Look at this example: struct Foo { } class Bar { } void main() { Foo*[Bar] a; auto aa = a.dup; // OK Foo*[ClassInfo] b; // Error: static assert "cannot call Foo*[TypeInfo_Class].dup because Foo* is not copyable" auto bb = b.d