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

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -