> Sorry, that turned into a bit of a rant, though hopefully a constructive one. 
> I wasn't directing this at you in particular; I just wanted to properly get 
> those points across.

No worries at all, we're all working towards the same goal here.

While I agree that the current proposals feel heavy, equally heavy is creating 
an entire type, a one-case enum, for the sake of one function. It may fit into 
the current language design but it is not (IMO) nice by any means. I'm also not 
a huge fan of the existing proposals, including my own dollar-sign proposal. 
But I would like to see some version of this added to the language because it 
does feel awkward to have to rearrange the sentence structure of a function to 
fit Swift's syntax. Just as ending a sentence with a preposition is something 
up with which some people won't put, but which is nevertheless useful to avoid 
awkward sentence structure, I'd prefer not to have to rearrange the English 
sentence structure of a sentence to comply with Swift's syntactical rules — I'd 
like to avoid the awkwardness. So I'll throw one more idea out there.

Older versions of Swift used # to indicate "special" behavior regarding 
parameter labels. Since that use has been deprecated, maybe we could resurrect 
# for trailing argument labels — in theory, for any positional argument labels, 
but one step at a time. This would also fit nicely with the current use of 
#selector, since when used for trailing arguments, # would *select* the 
function.

// Define
func adding(_ other: Self) // default behavior
func adding(_ other: Self, #reportingOverflow)) // overflow reported

// Call
x.adding(y)
x.adding(y, #reportingOverflow)

// Selectors
#selector(adding(_:))
#selector(adding(_:, #reportingOverflow))
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to