Open
Description
In atom A Little Reflection you introduce an object and a trait Name to add a toString to any class. It is unclear to me why the object is needed. This code without an object seems to work equally well:
trait Naam {
override def toString =
currentMirror.reflect(this).symbol.toString.replace('$', ' ').split(' ').last
}
class Noot extends Naam
println((new Noot).toString) // ---> 'Noot'
Metadata
Metadata
Assignees
Labels
No labels