8000 Scala 3 book - collections - tuple apply access? · Issue #2031 · scala/docs.scala-lang · GitHub
[go: up one dir, main page]

Skip to content
< 8000 script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/sessions-eed3aa0554dd.js" defer="defer">
Scala 3 book - collections - tuple apply access? #2031
Closed
@Sciss

Description

@Sciss

https://github.com/scala/docs.scala-lang/blob/main/_overviews/scala3-book/taste-collections.md

I just intuitively tried if tuple apply works with static indices, and it does, which is very cool. I don't know if that should be the preferred way to access them? I.e. instead of

case class Person(name: String)

val t = (11, "eleven", Person("Eleven"))

t._1   // 11
t._2   // "eleven"
t._3   // Person("Eleven")

would it be better to write

t(0)   // 11
t(1)   // "eleven"
t(2)   // Person("Eleven")

?

< 4A11 /div>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0