|
Hey i can do that in $php too! function execute($order, $callbacks){
foreach($order as $i){
$callbacks[$i]();
}
}
function abcProcs(){
foreach(func_get_args() as $f){
eval("function $f() { echo '$f'; };");
}
}
abcProcs("A","B","C");
execute([0,0,1,2,1,2], ['A','B','C']);
edit:you don't have to quote the function names (just to show they are really functions and not closures): execute([0,0,1,2,1,2], [A,B,C]);
|
Nim isn't C/C++, but it performs like it is C/C++. Nim isn't Golang, either, but it compiles programs like Go does, down to a self-contained binary with no dependencies. You can even statically link a Nim program against musl libc to ship without even a dependency on glibc.
This puts a completely new spin on writing performant code - just skip the C and write your code in pure Nim. It's a lot like writing Python except you produce comparable results to what you would get from writing your code in C or Go.