Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you are lucky to be using scala a simple bean he showed is like:

case class Mountain( val name: String, val latitude: Int, val longtitude: Int, var country: String)

For the above code you get a nice factory like

Mountain('name', 11, 12, 'nowhere')

with hashCode, toString and equals. Plus that you can use this class to decompose it using pattern matching:

mountain match { case Mountain(name, _, _, country) => println(name + ' located in ' + country) }

The future is here - it's just not evenly distributed:

http://scala-lang.org



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: