# \[Pitch\] Custom Metadata Attributes

**URL:** <https://forums.swift.org/t/pitch-custom-metadata-attributes/62016>\
**Category:** Pitches\
**Created:** [December 13, 2022, 5:21pm UTC](https://forums.swift.org/t/pitch-custom-metadata-attributes/62016 "2022-12-13T17:21:26Z")\
**Posts on this page:** 1\
**Showing post:** 53

<div class="post-metadata">

**Author:** ![Nickolas\_Pohilets](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/nickolas_pohilets/32/10659_2.png) [@Nickolas\_Pohilets](https://forums.swift.org/u/Nickolas_Pohilets)\
**Post date:** [January 1, 2023, 1:28pm UTC](https://forums.swift.org/t/pitch-custom-metadata-attributes/62016/53 "2023-01-01T13:28:34Z")

</div>

I think it should be possible to use meta types constrainted to protocols in the signature of the `init(attachedTo:)`.

```swift
struct Flag {
    init(attachedTo archetype: @escaping (AsyncSequence.Type) -> MyProtocol.Type)
}

@Flag
struct MyType<T: AsyncSequence>: MyProtocol { ... }

```

It can be challenging through to express everything that can go into `where` clause.

I think with [generalized existentials](https://forums.swift.org/t/syntax-for-existential-type-as-a-box-for-generic-type/40751), it should be possible to capture `where` clause by combining all generic arguments into a dummy tuple type:

```swift
@Flag
struct Zipper<A: Sequence, B: Sequence> where A.Element == B.Element {
    typealias Element = A.Element
}

struct Flag {
    init(attachedTo archetype: @escaping (any <A: Sequence, B: Sequence> (A, B).Type where A.Element == B.Element) -> Sequence.Type)
}

```

But even this does not allow to capture the fact that `Element` of the resulting sequence type is the same as element of `A` and `B`.

---

_[View the full topic](https://forums.swift.org/t/pitch-custom-metadata-attributes/62016)._
