How does the Enumeration.Value of a scala enumeration knows the name of the member? -
in scala, can create enumeration this:
object weekday extends enumeration {   val monday, tuesday = value }   you can call tostring() name of member @ runtime
val name = weekday.monday.tostring // name = "monday"   how possible? value method creates new object time, how can method access name of declared member without of compiler? pure scala magic me.
 
 
  
Comments
Post a Comment