定义与调用的不同参数格式
我很好奇为什么主构造函数参数必须在类型定义中缩进到左括号之外,但在调用时可以使用类型名称缩进。
type AnIncrediblyLaboriouslyEternallyLongTypeName(arg1, arg2,
arg3, arg4) = //WARNING: Possible incorrect indentation
class end
let x = AnIncrediblyLaboriouslyEternallyLongTypeName(
1, 2, 3, 4) //works
解决方案是将参数缩进到第二个显示器的左边缘之外:
type AnIncrediblyLaboriouslyEternallyLongTypeName(arg1, arg2,
arg3, arg4) =
class end
我想知道为什么这两种情况下的规则不同。
这也适用于方法。我只是选择主构造函数作为示例。
I'm curious why primary constructor args must be indented beyond the opening paren, in the type definition, yet may be indented with the type name when invoked.
type AnIncrediblyLaboriouslyEternallyLongTypeName(arg1, arg2,
arg3, arg4) = //WARNING: Possible incorrect indentation
class end
let x = AnIncrediblyLaboriouslyEternallyLongTypeName(
1, 2, 3, 4) //works
The solution is to indent the args beyond the left edge of your second monitor:
type AnIncrediblyLaboriouslyEternallyLongTypeName(arg1, arg2,
arg3, arg4) =
class end
I'm wondering why the rules are different in these two scenarios.
This also applies to methods. I just chose primary constructors as an example.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不记得了,但请注意,这
也是允许的。
I do not recall, but note that this
is also allowed.