string mixin output works when directly used but when generator is used D fails

2018-05-29 Thread DigitalDesigns via Digitalmars-d-learn

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.


Re: string mixin output works when directly used but when generator is used D fails

2018-05-30 Thread Simen Kjærås via Digitalmars-d-learn

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