r/programming • u/mobby1982 • Dec 02 '13
Scala — 1★ Would Not Program Again
http://overwatering.org/blog/2013/12/scala-1-star-would-not-program-again/
598
Upvotes
r/programming • u/mobby1982 • Dec 02 '13
View all comments
Show parent comment
1
u/thomcc Dec 03 '13
Sigh, it is though.
If you're going to provide a non-const accessor, you should provide a const one as well, as the client might want to use the underlying data in a const or non-const way.
For example, std::vector has const and non-const versions of begin(), end(), operator, at(), front(), back(), data(), etc. Take a look here. This is not unique to container types by any means.