[swift-evolution] [Pitch] Introduce user-defined dynamically "callable" types

Joe Groff jgroff at apple.com
Fri Nov 10 14:54:42 CST 2017



> On Nov 10, 2017, at 12:16 PM, Goffredo Marocchi <panajev at gmail.com> wrote:
> 
> 
> Sent from my iPhone
> 
>> On 10 Nov 2017, at 19:42, Joe Groff via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> Through great pain and community anguish, we pushed ourselves to a model where argument labels are parts of the declaration name, not part of the call argument
> 
> Hey Joe, does this mean it is likely there is little to no chance to have argument labels for closures and stored functions back? Sorry to bring noise in here, but your words put a grim outlook on something the core team said it would be revisited last year in the next Swift iteration.

Not at all. The idea for closure labels is that the labels would still be part of the name, but that you could give compound names to closure variables in addition to named functions. That would let you write something like:

let foo(bar:) : (Int) -> String = { "\($0)" }
foo(bar: 0)

Or, with a bit more sugar:

	let foo : (bar: Int) -> String = { "\($0)" } // Notationally, we write the labels with the type, but they become part of the 'let' name
	foo(bar: 0)

-Joe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171110/7d76a9e7/attachment.html>


More information about the swift-evolution mailing list