hamsters icon indicating copy to clipboard operation
hamsters copied to clipboard

Write def (macro?) for Show

Open loicdescotte opened this issue 7 years ago • 2 comments

Recurring demand from a few number of users

loicdescotte avatar Jan 29 '18 07:01 loicdescotte

With Scala 2.13 it will be possible to do it without macro with something like :

  def show(p: Product): String =
    p.productElementNames.zip(p.productIterator)
     .map { case (name, value) => s"$name=$value" }
     .mkString(p.productPrefix + "(", ", ", ")")

loicdescotte avatar Aug 19 '18 20:08 loicdescotte

pushed #117 PR with macro-free show method on case classes

loicdescotte avatar Sep 20 '18 13:09 loicdescotte