-
-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better prefix for $echo #1873
Comments
File name and line also could be useful, maybe. |
File-name can already be done with An example: module main;
import std::io;
fn int main() {
$echo "Compiler says hello in file " +++ $$FILE +++ " on line ";
$echo $$LINE;
io::printn("Hello, World!");
return 0;
} Produces:
So I would not include filename and line into module main;
import std::io;
macro to_string($num) {
char[] $res;
$for (;$num != 0; $num = $num / 10)
$res = { (char) ('0' + $num % 10) } +++ $res;
$endfor
return (String) $res;
}
macro compiler_message($msg) {
$echo $msg +++ " in file " +++ $$FILE +++ " on line " +++ to_string($$LINE);
}
fn int main() {
$echo "Compiler says hello in file " +++ $$FILE +++ " on line ";
$echo $$LINE;
io::printn("Hello, World!");
compiler_message("Hello from compiler");
return 0;
} Correctly prints:
Though I must admit that this |
ok, makes sense. I like macros in C3, one can solve any problem with them :) re |
Nope, that just prints |
No, that does not work. That's why I opened #1874, Christoffer told me in Discord that it would be a good addition. |
So have you decided yet? 😄 |
I would suggest |
Currently using
$echo
adds]
as a prefix, which is a bit confusing.It might be better to use something like
$
orc3c >
.The text was updated successfully, but these errors were encountered: