Ah, thanks Anton! But wouldn't/couldn't things be different if tuples was written with eg ⊂⊃ instead of parentheses? (let's ignore the practical implications (difficult to write etc) for the moment)
For example, here's an optional tuple whose single element is a function: ⊂Int -> Int⊃? and here is an optional function: (Int -> Int)? In this thought-experiment, parentheses are _only_ used for grouping (setting priorities), and they are the only grouping which is sloppy/forgiving, so this would also be an optional tuple whose single element is a function: ((((((((⊂Int -> Int⊃))))))?)) But this would be an optional tuple whose single element is a single element tuple whose single element is a function: ⊂⊂Int -> Int⊃⊃? /Jens On Wed, Jul 6, 2016 at 12:23 PM, Anton Zhilin <[email protected]> wrote: > > 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. > -- bitCycle AB | Smedjegatan 12 | 742 32 Östhammar | Sweden http://www.bitcycle.com/ Phone: +46-73-753 24 62 E-mail: [email protected]
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
