# About \`NamedTuple\` with \`Selectable\`

**URL:** <https://contributors.scala-lang.org/t/about-namedtuple-with-selectable/7112>\
**Category:** Language Design\
**Created:** [April 27, 2025, 4:14am UTC](https://contributors.scala-lang.org/t/about-namedtuple-with-selectable/7112 "2025-04-27T04:14:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jilen](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/jilen/32/3220_2.png) [@jilen](https://contributors.scala-lang.org/u/jilen)\
**Post date:** [April 27, 2025, 4:14am UTC](https://contributors.scala-lang.org/t/about-namedtuple-with-selectable/7112/1 "2025-04-27T04:14:11Z")

</div>

At first glance `NamedTuple` with `Selectable` combination seems fine.  
But after some closer consideration. `NamedTuples` just break the structural typeing nature of `Selectable`.

```scala

class Record extends Selectable {
   def selectDynamic(x: String) = 1
}

type R1 = Record { def f1: Int; def f2: Int }
type R2 = Record { def f2: Int; def f1: Int }
type R3 = Record { def f1: Int }
type R11 = Record { type Fields = (f1: Int, f2: Int) }
type R12 = Record { type Fields = (f2: Int, f1: Int) }

summon[R1 =:= R2] // Yes
summon[R1 <:< R3] // Yes
summon[R1 =:= R11] // No
summon[R11 =:= R12] // No

```

Is this intentional design or an implementation limitation?

---

<div class="post-metadata">

**Author:** ![bishabosha](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/bishabosha/32/3101_2.png) [@bishabosha](https://contributors.scala-lang.org/u/bishabosha)\
**Post date:** [April 28, 2025, 12:06pm UTC](https://contributors.scala-lang.org/t/about-namedtuple-with-selectable/7112/2 "2025-04-28T12:06:10Z")

</div>

This is expected because there is no magic to make different types equal - (e.g. no conversion between `type Fields` and `val` refinements)

R11 and R12 is also expected because again no magic.

If you use the `Fields` encoding, its because you trade that unordered flexibility for a more deterministic implementation
