Skip to content

Atom "A Little Reflection", object/ trait Name #67

Open
@waij

Description

@waij

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

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