-
Notifications
You must be signed in to change notification settings - Fork 226
Closed
Labels
featureProposed language feature that solves one or more problemsProposed language feature that solves one or more problemsstate-duplicateThis issue or pull request already existsThis issue or pull request already exists
Description
Hello there! 🖖
I've found the explicitly specifying an enum's name is too boilerplate. So can u please add "shorter dot" syntax sugar?
Example:
enum CompassPoint {
case north
case south
case east
case west
}
var directionToHead = CompassPoint.west
The type of directionToHead
is inferred when it’s initialized with one of the possible values of CompassPoint. Once directionToHead
is declared as a CompassPoint
, you can set it to a different CompassPoint
value using a shorter dot syntax:
directionToHead = .east
The type of directionToHead
is already known, and so you can drop the type when setting its value. This makes for highly readable code when working with explicitly typed enumeration values.
if directionToHead == .east { doSomething() }
Metadata
Metadata
Assignees
Labels
featureProposed language feature that solves one or more problemsProposed language feature that solves one or more problemsstate-duplicateThis issue or pull request already existsThis issue or pull request already exists