# SE-0249: Key Path Expressions as Functions

**URL:** <https://forums.swift.org/t/se-0249-key-path-expressions-as-functions/21780>\
**Category:** Proposal Reviews\
**Created:** [March 19, 2019, 2:34pm UTC](https://forums.swift.org/t/se-0249-key-path-expressions-as-functions/21780 "2019-03-19T14:34:32Z")\
**Posts on this page:** 1\
**Showing post:** 19

<div class="post-metadata">

**Author:** ![masters3d](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@masters3d](https://forums.swift.org/u/masters3d)\
**Post date:** [March 19, 2019, 8:42pm UTC](https://forums.swift.org/t/se-0249-key-path-expressions-as-functions/21780/19 "2019-03-19T20:42:27Z")

</div>

- What is your evaluation of the proposal?  
I think this would cause confusion unless it also address tuples. If that is the case then that should cut the surface area of tuples which can help us get closer a 0110 being implemented.  
[https://github.com/apple/swift-evolution/blob/master/proposals/0110-distingish-single-tuple-arg.md](https://github.com/apple/swift-evolution/blob/master/proposals/0110-distingish-single-tuple-arg.md)

- Is the problem being addressed significant enough to warrant a change to Swift?  
Not by itself I am afraid. If I am able to use KeyPath notation in this way I would be confused by it as new user.

Look at the reasoning for reverting 0110 it was mostly due to closures which this proposal should address.

[https://lists.swift.org/pipermail/swift-evolution-announce/2017-June/000386.html](https://lists.swift.org/pipermail/swift-evolution-announce/2017-June/000386.html)

> <https://github.com/apple/swift/commit/f42158b12e2072ac258817edd455de3747a3ce38>
>
> It breaks cases where there really is a single unlabeled argument of tuple type,… like this:
> 
> let pairs = \[(1, "A"), (2, "B")\]
> print(pairs.map { $0.0 })

Edit:

```swift
  let pairs = [(1, "A"), (2, "B")]
  print(pairs.map { $0.0 })

```

I am saying that this is a great feature but it needs to include tupples KeyPath otherwise it will cause confusion.

> [@KeyPaths, Tuples and Swift 5](https://forums.swift.org/t/keypaths-tuples-and-swift-5/18465/2):
>
> I think this would be a great starter project. The runtime ABI for keypaths should not need any modification to handle tuple components, so there's no rush to implement this. There's an ABI document that describes the layout of key path objects; the details are somewhat out of date, but the high level structure is the same: A tuple component ought to be compiled to the same runtime representation as a "struct stored property" component, with the in-memory offset of the tuple element from the …

---

_[View the full topic](https://forums.swift.org/t/se-0249-key-path-expressions-as-functions/21780)._
