# Improving the UI of generics

**URL:** <https://forums.swift.org/t/improving-the-ui-of-generics/22814>\
**Category:** Discussion\
**Created:** [April 8, 2019, 3:48pm UTC](https://forums.swift.org/t/improving-the-ui-of-generics/22814 "2019-04-08T15:48:05Z")\
**Posts on this page:** 1\
**Showing post:** 104

<div class="post-metadata">

**Author:** ![Moximillian](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/moximillian/32/3055_2.png) [@Moximillian](https://forums.swift.org/u/Moximillian)\
**Post date:** [April 17, 2019, 7:25pm UTC](https://forums.swift.org/t/improving-the-ui-of-generics/22814/104 "2019-04-17T19:25:07Z")

</div>

> [@Joe\_Groff](#):
>
> Sure. I think this case falls well below the threshold of a "more complex situation", though, because `A` , `B` , and `Result` don't have any real identity beyond "the type of `a` / `b` /the return value", and so being able to refer to them directly as such strikes me as a lower-complexity state; you have fewer names, and it is straightforward to refer to the unnamed things in terms of named ones. If there were multiple arguments or returns involving the same type, that's the point at which I think it'd become useful to name the type independently.
> 
> Similarly, referring to a protocol with some of its associated types constrained is such a common thing that it seems unfortunate to me that today it forces you into a situation where you need to introduce a `where` clause, which is itself a pretty big complexity step up from applying constraints to type parameters, and need to use a notation that relies on naming type parameters to describe the constraint.

Yes, for simple cases shorthands are fine, a `return` keyword might be fine for it.

But in addition to shorthands consider those people who are not so intimately familiar with these relatively advanced concepts and syntax.

People have learned **generics** , it has named types, it’s maybe more similar to several other languages, and people have learned to use conformances, joined conformances and `where` clauses with it.

Now they try to use **existentials** , they are bit similar, except they don’t have names (really), and people mistake the Protocol for its name. But the where clauses are same, so some parts are familiar.

then we have **`some`**. Sure simple cases are fine. But if you go into situations similar to where clauses you’re confused again, just like with existentials.

The more I think of this It feels like fundamental flaw in swift syntax design (especially in protocols), and all the more important that both **existentials** `any` and **reverse generics** `some` should have named type syntax for ease of use, as well as, for handling complexity reasons. This is irrespective of whether there is a shorthand syntax for them.

EDIT:  
And by named type syntax I refer to the one mentioned before:  
`any Protocol A`  
`some Protocol S`

---

_[View the full topic](https://forums.swift.org/t/improving-the-ui-of-generics/22814)._
