Created
April 13, 2024 23:49
-
-
Save crazymonkyyy/4af8f9235c79e1864003afb54d299768 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- bar.d | |
void min(int a,int b){} | |
void f1(){} | |
void f3(){} | |
void f5(int){} | |
--- foo.d | |
void min(float a,float b){} | |
void f2(){} | |
void f4(){} | |
void f5(float){} | |
--- foobar.d | |
import foo; | |
import bar; | |
alias min=foo.min; | |
alias min=bar.min; | |
string makealias(string file,string funct){ | |
return "alias "~funct~"="~"file."~funct~";"; | |
} | |
static foreach(string funct;["f1","f2","f3","f4","f5"]){ | |
static foreach(string file;["foo","bar"]){ | |
static if (__traits(compiles,mixin(makealias(file,funct))){ | |
mixin(makealias(file,funct); | |
}}} | |
--- app.d | |
import foobar; | |
void main(){ | |
min(1,3); | |
min(1.0,3.0); | |
f1; | |
f2; | |
f3; | |
f4; | |
f5(1); | |
f5(13.37); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment