I forget to mention, this should be also valid:

let `42` = 42

print(`42`)

struct A {
    let `0` = 0
}

let number = A().0


-- 
Adrian Zubarev
Sent with Airmail

Am 9. März 2017 um 08:24:54, Adrian Zubarev (adrian.zuba...@devandartist.com) 
schrieb:

Hi Swift community, I’d like to pitch this idea again.

Swift already has the pitched feature, but it is exclusive for tuples only. 
SE–0071 allowed the use of keywords after the . in a member access, except for 
those keywords that have special meaning by using back-ticks. However, members 
starting with numbers are not special keywords and as already mentioned, 
numerical members are already allowed in tuples.

I propose to extend that capability to the whole language and make that 
behavior consistent. To disambiguate members starting with a number one would 
need to use back-ticks.

// Enum
enum ErrorCode : String {
      
    case `2345` = "my description for 2345"
    case `123a` = "my description for 123a"
    case `123b` = "my description for 123b"
}

let code = ErrorCode.2345

// Function
func `42foo`(label: Type, `12345`: Type, `0987something`: Type) { … }

// Tuple
(`1`: Int, `2`: Int)
My question is: would that be in scope for Swift 4?



-- 
Adrian Zubarev
Sent with Airmail
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to