开发者

Different arg formatting for definitions vs invocations

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,
          开发者_StackOverflow                                        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.


I do not recall, but note that this

type AnIncrediblyLaboriouslyEternallyLongTypeName
        (arg1, arg2, arg3, arg4) = // works
  class end 

is also allowed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜