Re: Swift Question: Tuple Return Types
Re: Swift Question: Tuple Return Types
- Subject: Re: Swift Question: Tuple Return Types
- From: Marco S Hyman <email@hidden>
- Date: Thu, 26 Feb 2015 16:51:05 -0800
> So here’s my question: Is it correct to say that every function / method / closure returns some sort of tuple, including functions / methods / closures that return a single item?
The grammar says a function returns this: attributes-opt type
A type is
type → array-type dictionary-type function-type type-identifier tuple-type optional-type implicitly-unwrapped-optional-type protocol-composition-type metatype-type
A strict reading of the grammar says that a tuple-type is only one of the
many types that can be returned. Also, (Int) and Int can be used
interchangeably because the type of (Int) is not a tuple (according to the
book). It is an Int.
(Type) seems to be magic syntax.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden