可以像Ruby一样在模块中使用静态方法吗?
module Test
self.def test
puts "test"
end
end
Test::test
如果调用在同一文件中(如示例所示),则会出现“expecting token 'EOF', not 'end'” 的错误提示,而如果将调用放置在不同的文件中,则会出现“expecting token 'CONST', not 'test'” 的错误提示。
我做错了什么?在Crystal中是否有模块中的静态方法?