« Return to Thread: So is Scala going to add an Effect System... or what?

Re: So is Scala going to add an Effect System... or what?

by Daniel Spiewak :: Rate this Message:

Reply to Author | View in Thread

Actually, I disagree that Scala is unusable for writing libraries for Java consumption, you just have to be careful around things like traits and objects.  As for Scala being a "better Java" or a "better Haskell", I do agree that is the wrong approach.  It doesn't take much to be a "better Java", and I'm not even sure it's *possible* to be a "better Haskell".

The real question is: what *is* Scala?  What is it trying to be?  This is where we get into things like the merging of functional and object-oriented styles that we've all experienced in Scala, and yet can't quite define.  Scala should be aiming to become a "better Scala", that's true, but if we don't even know what it means for our language to be "Scala", what could it possibly mean for it to be a "better Scala"?

Personally, I like effect systems, but I don't think they have a place in Scala.  One of Scala's main goals from the very beginning AFAIK was Java interoperability.  As soon as you start introducing the more esoteric functional features like effect systems and Hindley-Milner type inference, you lose more and more of that compatibility.  Ricky pointed out that singleton objects are intensely painful to use from within Java.  This is just a small example of "purity over compatibility" (even if it is object-oriented rather than functional purity).  Given the trouble this causes, could you imagine what would happen if we started enforcing overloading via typeclasses rather than the current ad hoc system?

I think we need to be very careful about features like this.  I would want to see clear, demonstrable and *practical* benefits to an effect system *in Scala* before I would be convinced of its necessity.

Daniel

Ricky Clarkson wrote:
Haskell's goals were not to become mainstream.

Scala cannot really be a 'better Haskell' without losing subtyping.

Scala isn't even a 'better Java', as you can't use Scala to write
libraries for Java programmers to use.  Foo$.MODULE$ is not pleasant.

Instead of siding with what Scala should be a better version of, I'd
like to suggest that Scala should be a better version of Scala.
Effect systems are genuinely useful, but hard to get right.  I hope
one of the people asking for them can work on an implementation.  I'd
be interested to see how far you could go just writing one as a
library.

 « Return to Thread: So is Scala going to add an Effect System... or what?