dtrovwl75780 2014-12-18 07:45
浏览 22
已采纳

为什么Swift函数定义语法多余?

In C/C++/Java/Go, we use , to separate parameters:

(a int, b int)

In Objective C, we use : to indicate parameters:

:(int)a :(int)b

In Swift, we have to use both : and , :

(a:int, b:int)

Is the redundancy necessary?

  • 写回答

2条回答 默认 最新

  • doushizhou4477 2014-12-18 07:50
    关注

    Swift might have external and internal parameter names:

    (external internal:Int)
    

    It would create a lot of ambiguity if there wasn't distinctive separators.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?