可以这样打印源码位置信息:
func main {
println("__package__:", __package__)
println("__FILE__:", __FILE__)
println("__LINE__:", __LINE__)
println("__func__:", __func__)
}
执行效果如下:
$ wa run hello.wa
__package__: __main__
__FILE__: hello.wa
__LINE__: 4
__func__: main
原文: https://wa-lang.org/smalltalk/st0050.html