Chapel中如何获取当前文件、模块、过程的名称
How to get the name of the current file, module, and procedure in Chapel
在 Chapel 中,是否可以通过某种方式(例如,通过辅助函数)获取当前文件、模块或过程的名称?我的目标是打印例程名称,而无需在 writeln()
.
中显式地手写
proc calculate_this_and_that_ver2() {
// writeln( "In calculate_this_and_that_ver2()" ); // long...
writeln( "In ", modname(), " : ", procname() );
...
}
我在这里希望的可能类似于Swift中的#function
等:
func mytest() {
print( "file =", #file, "func =", #function, "line =", #line )
}
mytest() // --> file = test.swift func = mytest() line = 2
我不认为 Chapel 目前支持这样的功能,尽管它已经不时被讨论并且在这些对话中通常得到积极的回应。我建议在我们的 GitHub issues page.
上针对它提交功能请求未来
在 Chapel 中,是否可以通过某种方式(例如,通过辅助函数)获取当前文件、模块或过程的名称?我的目标是打印例程名称,而无需在 writeln()
.
proc calculate_this_and_that_ver2() {
// writeln( "In calculate_this_and_that_ver2()" ); // long...
writeln( "In ", modname(), " : ", procname() );
...
}
我在这里希望的可能类似于Swift中的#function
等:
func mytest() {
print( "file =", #file, "func =", #function, "line =", #line )
}
mytest() // --> file = test.swift func = mytest() line = 2
我不认为 Chapel 目前支持这样的功能,尽管它已经不时被讨论并且在这些对话中通常得到积极的回应。我建议在我们的 GitHub issues page.
上针对它提交功能请求未来