[swift-evolution] Proposal: Remove implicit tuple splat behavior from function applications

Brent Royal-Gordon brent at architechies.com
Thu Jan 28 19:37:07 CST 2016


> Brent — Not sure how it all plays out, but would it work for you to use tuples to make all the functions in your chain take a single arg? e.g.:
> 
>   private func recordAllocatorWithVersionMemory(args: (versionMemory: CloudDatabaseVersionMemoryType?, typeName: String, _ cloudValue: CloudValue)) throws -> (CKRecord, CloudValue)
> 
>   private func writeAttributesAndReferencesToRecord(args: (record: CKRecord, cloudValue: CloudValue))

Yes, but it would be less elegant. As it is, these are normal functions written to operate on a single model instance, and I just happen to use them with `map` and `forEach` to apply them to many instances. Rewriting them to explicitly take tuples makes the code more awkward. Obviously this ends up boiling down to code style, but I would be very sorry to see the capability to essentially prepare a bunch of argument lists and apply them all to a function go.

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list