# \[Pitch 2\] Light-weight same-type requirement syntax

**URL:** <https://forums.swift.org/t/pitch-2-light-weight-same-type-requirement-syntax/55081>\
**Category:** Pitches\
**Created:** [February 3, 2022, 5:20pm UTC](https://forums.swift.org/t/pitch-2-light-weight-same-type-requirement-syntax/55081 "2022-02-03T17:20:44Z")\
**Posts on this page:** 1\
**Showing post:** 73

<div class="post-metadata">

**Author:** ![ksluder](https://avatars.discourse-cdn.com/v4/letter/k/eada6e/32.png) [@ksluder](https://forums.swift.org/u/ksluder)\
**Post date:** [February 5, 2022, 7:26am UTC](https://forums.swift.org/t/pitch-2-light-weight-same-type-requirement-syntax/55081/73 "2022-02-05T07:26:12Z")

</div>

> [@Douglas\_Gregor](#):
>
> In Swift, we write `equal(to:)` as `==` in part because we don't want to privilege one particular type, so I'm not sure where your argument leads.

Spelling it `==` doesn’t avoid having to choose between `func ==(lhs: A, rhs: B)` and `func ==(lhs: B, rhs: A)`. Swift still privileges the type of the left-hand side, so you have to write definitions of both functions. Some people consider this redundancy a damning indictment of languages without multimethods.

The argument that one “really” wants “multi-Self protocols” feels like the same argument. It’s also a straw man, because Rust doesn’t implement conversions using a trait with 2 generic parameters. It models conversions using two separate traits, `From<T>` and `Into<T>`. [A single generic `impl<T, U> Into<U> for T`](https://github.com/rust-lang/rust/blob/master/library/core/src/convert/mod.rs#L537) provides the `Into` that mirrors any user-defined `impl From`.

**That** , @Slava_Pestov, is the usefulness of generic traits—though perhaps you could call it generic `impl`s, because the arity of the `impl` does not match that of the `trait`! But even though `impl Into` has two type parameters, it’s very clear which is Self, because the `impl` is `for` one of them.

Edit: Maybe conditional conformances provide the equivalent functionality to this use of generic `impl`s?

---

_[View the full topic](https://forums.swift.org/t/pitch-2-light-weight-same-type-requirement-syntax/55081)._
