How to access tuple-elements with key paths?

struct S {
    var a = (1, 2, 3)
}
let sa = \S.a // OK
let sa0 = \S.a.0 // ERR: Type of expression is ambiguous without more context

Is it possible using some other syntax?

It’s not possible yet. There was some discussion here: Pitch: Even Smarter KeyPaths?

It sounds like it just needs an implementation.

3 Likes