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

bash - Performing variable substitution in a string -

How to group boxplot outliers in gnuplot -