[swift-evolution] Require parameter names for ENUM Associated Types?

Karl razielim at gmail.com
Wed Nov 30 10:45:55 CST 2016


> On 30 Nov 2016, at 14:11, Steve Prescott via swift-evolution <swift-evolution at swift.org> wrote:
> 
> As the original poster of this thread, I wanted to re-state the original question:
> 
> Should enums REQUIRE parameter names?
> 
> Pro:		The syntax would more closely match that for functions, which requires names for all parameters (unless you say “_”) vs. the current syntax that is sort of C-like.
> Con:	More verbose
> 
> With this suggestion, your declaration of a variable that uses an enum would resemble calling a function.  e.g.:
> 
> var myTeam = Team.football (name: “Redskins”, city: “Washington, DC”, quarterback: “Kirk Cousins”)
> 

I don’t think they should be required. The payload is actually a tuple, and element names are not required for tuples (and not even supported for single-element tuples). 

Your example is still possible without requiring labels; all that would change is that code which works today would suddenly break. Unless I’m mistaken, your proposal is about removing functionality and does not add anything.

- Karl


More information about the swift-evolution mailing list