www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Recursive mixin templates

reply "Sebastian Graf" <SebastianGraf t-online.de> writes:
I aim to use a simplistic, rough edged property generator, but
I'm having issues.
See http://dpaste.dzfl.pl/72837a7a.
My code and mixin logic seems to work basically, but it gets
hairy when using mixinMap to generate getters and setters from a
list in a recursive template fashion. It won't work if I generate
both getters and setters with mixinMap, but it compiles fine if I
e.g. want only getters.
Any help? I smell a compiler bug if I haven't done something
stupid.
May 16 2013
parent reply "Simen Kjaeraas" <simen.kjaras gmail.com> writes:
On Thu, 16 May 2013 17:01:54 +0200, Sebastian Graf  
<SebastianGraf t-online.de> wrote:

 I aim to use a simplistic, rough edged property generator, but
 I'm having issues.
 See http://dpaste.dzfl.pl/72837a7a.
 My code and mixin logic seems to work basically, but it gets
 hairy when using mixinMap to generate getters and setters from a
 list in a recursive template fashion. It won't work if I generate
 both getters and setters with mixinMap, but it compiles fine if I
 e.g. want only getters.
 Any help? I smell a compiler bug if I haven't done something
 stupid.
This is one of those weird things. I believe it is intentional, but I feel it should be a bug. Basically, overload sets cannot cross mixin borders. So if two mixins create a function with the same name, they don't overload properly. I'd say add it to BugZilla if it's not already there. Comment on the relevant bug if it is - this is not good for the language. -- Simen
May 16 2013
parent "Sebastian Graf" <SebastianGraf t-online.de> writes:
On Thursday, 16 May 2013 at 15:34:54 UTC, Simen Kjaeraas wrote:
 This is one of those weird things. I believe it is intentional, 
 but
 I feel it should be a bug. Basically, overload sets cannot cross
 mixin borders. So if two mixins create a function with the same 
 name,
 they don't overload properly.

 I'd say add it to BugZilla if it's not already there. Comment 
 on the
 relevant bug if it is - this is not good for the language.
http://d.puremagic.com/issues/show_bug.cgi?id=10103
May 17 2013