DEV Community

Discussion on: Sometimes, the elegant implementation is just a function

 
mortoray profile image
edA‑qa mort‑ora‑y

I can also be pedantic and say it is a type. :)

Any type is a reference to a value and operations on that value. A class is one way of expressing a type. Types are defined by the operations that can be performed on them, not just their raw value -- if one can even define a value absent of any operations on it.

The part I dislike is that classes can represent a bunch of things that don't work like value types as well. I wish these were distinct entities. I called them "service" in the language I was working on.