www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - string mixin output works when directly used but when generator is

reply DigitalDesigns <DigitalDesigns gmail.com> writes:
https://dpaste.dzfl.pl/67691db19ce8

Just delete 9 to 29 for the code to work. Note that none of the 
code effects the output but D gives strange errors. In my code it 
says the interface members are not implemented(which they are)

		foreach (member; __traits(allMembers, T))
		{
			static foreach (overload; MemberFunctionsTuple!(T, member))
			{
				static if (__traits(getProtection, __traits(getMember, T, 
member)) == "public")
				{
					foreach(a; __traits(getAttributes, overload))
						static if (is(typeof(a) == string) && a.length > 0 && a == 
"InterfaceMembers")
						{		
							string q;
							foreach(b; __traits(getAttributes, overload))
								static if (is(typeof(b) == string) && b.length > 0 && b 
== "InterfaceMembers")
									continue;
								else
									q ~= " ("~b.stringof~") ";

							//s ~= "\t"~q~cloneFunction!(overload, T) ~ ";\n";
						}
				}
			}
		}

is somehow breaking the interface. It should have no effect on it 
at all. Seems like a bug to me.
May 29 2018
parent Simen =?UTF-8?B?S2rDpnLDpXM=?= <simen.kjaras gmail.com> writes:
On Tuesday, 29 May 2018 at 21:19:01 UTC, DigitalDesigns wrote:
 https://dpaste.dzfl.pl/67691db19ce8
Simplified: interface A { import std.meta : AliasSeq; alias a = AliasSeq!(__traits(getMember, B, "foo")); void foo(); } class B : A { void foo() { } } It seems the compiler is looking at the class before the interface is ready, and that the method thus isn't marked as implementing an interface method. Filed as https://issues.dlang.org/show_bug.cgi?id=18915 -- Simen
May 30 2018