Skip to content

Instantly share code, notes, and snippets.

@MrSmith33
Created May 5, 2017 12:44
Show Gist options
  • Select an option

  • Save MrSmith33/ae646b993ed31ea2b1558b902ef4e46e to your computer and use it in GitHub Desktop.

Select an option

Save MrSmith33/ae646b993ed31ea2b1558b902ef4e46e to your computer and use it in GitHub Desktop.
import std.stdio;
void main()
{
HighLevel h;
writeln(h.fun());
}
struct HighLevel
{
ComponentA a;
ComponentB!a b;
int fun()
{
return b.funB();
}
}
struct ComponentA
{
int funA()
{
return 42;
}
}
struct ComponentB(alias a)
{
int funB()
{
return a.funA(); // Error: need 'this' for 'a' of type 'ComponentA'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment