Thanks for the beautiful section on Macros, I learned a lot!
I have a problem with the following macro, which does not compile (beta 0.1.029):
macro :: () -> int #expand {
if a <b {
defer print("Defer inside macro\n"); return "Backtick return macro";
}
return 1;
}
It gives the compilation error:
D:/Jai/The book of Jai/Chapter 9 - Metaprogramming - Compile-time code execution/code/macros.jai:91,31: Info: While expanding macro 'macro2' here...
print("max is %\n", maxm(b, c)); // => max is 7
print("macro2 returns %\n", macro2()); // => 1
D:/Jai/The book of Jai/Chapter 9 - Metaprogramming - Compile-time code execution/code/macros.jai:29,6: Error: Too many return values: Wanted 0, got 1.
Thanks for the beautiful section on Macros, I learned a lot!
I have a problem with the following macro, which does not compile (beta 0.1.029):
macro :: () -> int #expand { if
a <
b {defer print("Defer inside macro\n");
return "Backtick return macro"; } return 1; }It gives the compilation error: D:/Jai/The book of Jai/Chapter 9 - Metaprogramming - Compile-time code execution/code/macros.jai:91,31: Info: While expanding macro 'macro2' here...
D:/Jai/The book of Jai/Chapter 9 - Metaprogramming - Compile-time code execution/code/macros.jai:29,6: Error: Too many return values: Wanted 0, got 1.
D:/Jai/The book of Jai/Chapter 9 - Metaprogramming - Compile-time code execution/code/macros.jai:82,9: Info: ... Here is the procedure being called.
I don't know how to correct this, changing the returned string (which doesn't seem ok because return type is int) to `return 0 gives the same error.
`return 1 also doesn't help.
I don't know how to correct this example.