4 ms·
What do you gain from using objects in that way, as opposed to immutable structs and functions?
by kyllo 12y ago
What do you gain from using objects in that way, as opposed to immutable structs and functions?
- tormeh 12y agoI program in Scala, so structs are not a thing (classes can extend/"inherit" AnyVal to be allocated on the stack, though, I think). Functions are nice, but from a pure syntax standpoint I often prefer methods because it limits the parantheses. It's especially neat when the methods take no arguments, like .toString. But yeah, otherwise there's no difference, really.