# ArraySlice\<T\> versus Slice\<Array\<T\>\>

**URL:** <https://forums.swift.org/t/arrayslice-t-versus-slice-array-t/68041>\
**Category:** Using Swift\
**Created:** [October 24, 2023, 6:24pm UTC](https://forums.swift.org/t/arrayslice-t-versus-slice-array-t/68041 "2023-10-24T18:24:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![asdf\_bro](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@asdf\_bro](https://forums.swift.org/u/asdf_bro)\
**Post date:** [October 24, 2023, 6:24pm UTC](https://forums.swift.org/t/arrayslice-t-versus-slice-array-t/68041/1 "2023-10-24T18:24:01Z")

</div>

`ArraySlice<T>` (4 words) is larger than `Slice<Array<T>>` (3 words) and has worse code gen in many cases.

Is there any path to changing the return type of `Array`'s unlabeled `subscript`s?

---

<div class="post-metadata">

**Author:** ![scanon](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/scanon/32/2445_2.png) [@scanon](https://forums.swift.org/u/scanon)\
**Post date:** [October 24, 2023, 7:50pm UTC](https://forums.swift.org/t/arrayslice-t-versus-slice-array-t/68041/2 "2023-10-24T19:50:43Z")

</div>

> [@asdf\_bro](#):
>
> Is there any path to changing the return type of `Array`'s unlabeled `subscript`s?

No. This would be source- and binary-breaking. There is a path to improving the codegen for ArraySlice, however (especially if you report bugs for the bad cases you find)!

ArraySlice codegen is also a source of annoyance for me, by the way, but happily one that a number of folks are interested in fixing.
