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

Scala, is that you?? :)


val immutableString = "foo"

val immutableList = List(1, 2, 3)

val immutableMap = Map("foo" -> "bar")

var mutableString = "foo"

val mutableList = collection.mutable.List(1, 2, 3)

val mutableMap = collection.mutable.Map("foo" -> "bar")


No, this is not the same as the linked library. See here: http://stackoverflow.com/questions/6425165/statically-decide...

A similar example in Scala would be a class that has only 'val' types and no 'var' types, but read through the stackoverflow post to see the complexities.


case class Foo(bar: String, baz: String)


Or in Kotlin:

    data class Foo(bar: String, baz: String)




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

Search: