# Enums and Dynamic Member Lookup

**URL:** <https://forums.swift.org/t/enums-and-dynamic-member-lookup/18001>\
**Category:** Pitches\
**Created:** [November 15, 2018, 12:14am UTC](https://forums.swift.org/t/enums-and-dynamic-member-lookup/18001 "2018-11-15T00:14:41Z")\
**Posts on this page:** 1\
**Showing post:** 21

<div class="post-metadata">

**Author:** ![dan-zheng](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/dan-zheng/32/2534_2.png) [@dan-zheng](https://forums.swift.org/u/dan-zheng)\
**Post date:** [November 15, 2018, 6:09pm UTC](https://forums.swift.org/t/enums-and-dynamic-member-lookup/18001/21 "2018-11-15T18:09:28Z")

</div>

> [@jlukas](#):
>
> Why not a subscript that takes multiple arguments?
> 
> ```swift
> vector[.x, .x, .y, .y]
> 
> ```

Nice. We're getting into minutia now, but I feel a small `SwizzleComponent` enum with cases `x`, `y`, `z`, etc. is nicer than a large `Swizzle` enum whose cases are the combinations of all orderings (e.g. `.xxyy`).

`SwizzleComponent` has a much smaller surface area and is more composable. I think it's harder to pattern match on "concatenated" `.xxyy` cases.

A related idea is to use `OptionSet`? That would enable grouping of related swizzles. Need to think more about it.

* * *

I think we should continue further discussion of swizzles on the [SIMD proposal thread](https://forums.swift.org/t/se-0229-simd-vectors/16518). Folks there may have more ideas.

---

_[View the full topic](https://forums.swift.org/t/enums-and-dynamic-member-lookup/18001)._
