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

Steve Prescott steve.l.prescott at gmail.com
Tue Nov 29 07:48:18 CST 2016


Has there been any discussion of REQUIRING names for associated types in an enum?

e.g.,
  Current	     =   “case error (String, Int)”						// No names
  Proposed   =    “case error (errorString: String, errorCode: Int)”		// Has names

I know that Swift allows this today — optionally.  To me, it seems that requiring the parameter names would be more consistent with func syntax.  The current syntax (defaulting to no names) leads to declaration of vars that look C-like, to me:

let myResult = Result.error (“It failed”, -999)




More information about the swift-evolution mailing list