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

Tino Heth 2th at gmx.de
Sat Jan 30 03:54:52 CST 2016


> +1. Based on experience of splatting use in other languages it has limited applications. I assume feature not well known by Swift community just because of small demand. For those who needs splatting, it can be replicated by existing tooling manually or generalized by something similar to following code:
> func splat<T, U, R>(f: (T, U) -> R, _ tuple: (T, U)) -> R {
>     return f(tuple.0, tuple.1)
> }

If a set of splat functions would be available in stdlib, they could act as a temporary stand-in, but it is a poor replacement:
The beauty of splat is that it works for functions with an arbitrary number of parameters out of the box, and it is most useful when you have many parameters (something that is very uncommon in Cocoa — but I expect that this won't be true for new libraries that make use of default parameter values).
Swift has many convenience features and overlapping functionality, but tuple splat is singular and can't be replaced with other constructs.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160130/4d0f47b1/attachment.html>


More information about the swift-evolution mailing list