[swift-evolution] [Discussion] Parentheses

Anton Zhilin antonyzhilin at gmail.com
Wed Jul 6 05:23:17 CDT 2016


> Or maybe I have just forgotten the reasons for why there can be no such
thing as (a nested) single element tuple (type).

In Swift, types have their own (built-in) operators: infix '->', postfix
'?', postfix '!'.
Parentheses are required for grouping (setting priorities). If we allow
single element tuples, ambiguities arise:

(Int -> Int)?  // is that an optional tuple or just optional function?

By the way, in Haskell, which allows user-defined operators on types, there
is no single element tuple for pretty much the same reason.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160706/8d98a1d1/attachment.html>


More information about the swift-evolution mailing list