This page is no longer maintained — Please continue to the home page at

Re: Scala whiskers

1 reply
Seth Tisue
Joined: 2008-12-16,
User offline. Last seen 34 weeks 3 days ago.

>>>>> "Russ" == Russ Abbott <russ [dot] abbott [at] gmail [dot] com> writes:

Russ> One difference is that you can't use type parameters in the *val
Russ> *version. I don't understand why it would be a bad idea to extend
Russ> Scala to allow that.

Russ> A second difference is that as Seth pointed out the *def *version
Russ> allows function name overloading whereas the *val* version
Russ> doesn't. That seems to me to be a bit harder to solve. I once
Russ> proposed a solution. But let's leave that issue to the side for a
Russ> moment and forget about name overloading.

You can't just leave these issues to the side and forget about them.
Inheritance, overloading, covariance and contravariance, etc, are the
major issues you hit when you try to combine functional and
object-oriented programming in a Java-compatible(*) way. If you're
doing no OOP and you don't need Java compatibility, you don't need Scala

Seth Tisue
Joined: 2008-12-16,
User offline. Last seen 34 weeks 3 days ago.
Re: Scala whiskers

>>>>> "Russ" == Russ Abbott <russ [dot] abbott [at] gmail [dot] com> writes:

Tony> The differences between def and val are so enormous that it might
Tony> even be considered the single biggest difference that one could
Tony> possibly conceive in the language. Certainly those differences
Tony> are a fundamental property of the language such that if one or
Tony> the other were removed, would render the language fatally useless
Tony> (as in, even more useless than Java).

Russ> This is not a useful answer. I understand that you have strong
Russ> feelings about this, and perhaps that you think it's stupid of me
Russ> even to raise the issue.

For whatever it's worth, I believe Tony was answering Justin, not you.
There are two distinct def vs. val discussions happening here, the one
you started, and the new one Justin started. It was Justin who wrote:

Justin> The meanings of val and def are now so overlapping to the point
Justin> of reaching diminishing returns for the Scala programmer's
Justin> investment in time in deciding which to use. Having reached
Justin> terminal velocity, an optimizing (Scala) compiler could well
Justin> reduce defs of zero arguments to vals anyway.

which is completely different, and far more misguided, than what you've
been saying.

Regardless, I think your own def vs. val suggestion has been adequately
responded to by a number of people, including myself -- I'm at a loss
for anything new to say on the subject. I can only repeat that in order
to even have a coherent proposal you'll have to figure out how to
integrate it with OOP and Java, and none of us see a simpler way to do
that than the way Martin already did when he designed Scala. And it's
not our job to figure that out for you :-)

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland