Remove leading . in abbreviated enum uses in Swift

Originator:samdeane
Number:rdar://17185752 Date Originated:05-Jun-2014 02:51 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode6-Beta (6A215l)
Classification:UI/Usability Reproducible:Always
 
When referring to an enum value in Swift, we are allowed to drop the name of the enum, and use the case values, prefixed by a full stop:

eg:

	switch suit {
  		case .Spades:
			// do stuff
		  case .Hearts:
			// do stuff
	}


or

	self.callSomeMethodWhichExpectsASuit(.Hearts)


This is better than having to fully qualify the values, but it looks quirky, and the full stop seems superfluous in many situations.

Consider revising the syntax so that the full stop isn’t required. If it isn’t possible to have nothing there, consider a different mechanism for telling the parser that the next token is to be treated as an enum value (eg a different piece of punctuation, or even a keyword).

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!