8 ms·
There are so many problems with Scala, that the question of static vs. dynamic typing becomes secondary. Static typing could well be downright awesome, but Scal
by pron 13y ago
There are so many problems with Scala, that the question of static vs. dynamic typing becomes secondary. Static typing could well be downright awesome, but Scala is still a mess.
I'm repeating the same line for the third time today, but I find that Scala is for people who find Haskell too simple, and want to add mutability, inheritance and macros on top of it, while dropping safety, purity, and much of the type inference (and I'm certainly not a Haskell fan, but Scala makes Haskell seem like Logo).
For the life of me I can't understand what the language designers want, or how they think software should be written. It seems like they're finding it a fun challenge to see how many features from different languages can fit in a single compiler, and they justify each feature as necessary to solve some arcane problem.
I think it's the complete opposite of languages like Clojure and Erlang (or Java, even), whose designers started by pondering the major issues of software development, and tried to come up with a coherent solution, rather than pile on features, each plugs a specific hole, without any fundamental organizing principle.
- justin_hancock 13y agoI think you've hit the nail on the head with Scala. It feels every conceivable concept in language research has been thrown in. The lack of coherency is sometimes quite jarring. Coherency/conceptual integrity are things I look for in computing environments they make reasoning things much simpler as logical deductions can be made, I don't find myself doing that with Scala.
- eropple 13y agoYour mileage may certainly vary, but having used Scala pretty steadily for the last year, I find the strong majority of Scala code I see in practice generally very easy to intuit. You can do stupid things with it--see Scalaz, which is bad ideas[1] given form--but for the most part, people don't. I used to have the same concern you're expressing, and a few others besides--I've written comments on HN along the lines of "I'm writing Scala that I can't read the next day"--but I got past that stage not too long afterwards, and I find it remarkably predictable and consistent in everyday use. [1] - this isn't a fair characterization, see deeper in the tree
- asdasf 13y ago>You can do stupid things with it--see Scalaz, which is bad ideas given form Oh the irony.
- gohrt 13y agowhat is wrong with scalaz?
- eropple 13y agoSorry, that was a little more flip than it should have been. Scalaz attempts to wedge into Scala a set of idioms that don't really work well in Scala; as an OO language that's still largely imperative at its core, it's swimming upstream and the code--and the use of that code--is pretty clumsy. Scala isn't a pure-FP language, and trying to treat it as one doesn't really...work. Square peg, round hole. For me it falls in the "neat hack, but" bucket. That it can be done as Scalaz does is cool, but the practical value of it seems vastly oversold and I'm uncomfortable with the functional-everywhere political viewpoint pushed by some of its leaders (and fortunately Odersky seems opposed to a lot of it, which IMO bodes well for Scala's future).
- runT1ME 13y ago> as an OO language that's still largely imperative at its core Why do you say this? vals and immutable data strucutres are clearly emphasized in Scala, so how can you say that FP isn't at its core? >Scala isn't a pure-FP language, and trying to treat it as one doesn't really...work Why do you think scalaz concerns itself primarily with enforcing 'purity'? Scalaz' effects library isn't even part of it's core repo.
- lmm 13y agoMutability and inheritance are good solutions to certain classes of problems, and it's valuable to have them in your toolbelt. What's scala designed for? Programming - not just highly concurrent programming, not just quick scripts to do some text manipulation, not just web services for millions of requests, but all these things and more. It's the most generally applicable language I've ever seen, and there's real value in being able to write your whole platform in a single language which is nevertheless a good fit for a very wide range of problems. I don't think it's fair to say each feature is piled on to plug a specific hole; rather, a lot of the power of scala comes from the interaction of several features that are individually quite simple. E.g. unlike Haskell's typeclasses which have to be built into the language, in scala that's simply a pattern that you write in regular code. Unlike Erlang's built-in notion of actors, in scala Akka is "just" a library.
- pron 13y ago> Unlike Erlang's built-in notion of actors, in scala Akka is "just" a library. So what? In Erlang it's part of the language because Joe Armstrong et al. thought that this is how modern software should be written. They figured they'd need immutability, process isolation, and message passing. In Scala you can do that in a library minus (guaranteed) immutability and isolation, which were the whole point to begin with. Same for Haskell. They've figured that an unbreakable type-system with functional purity will make it easier to write bug free code. So Scala takes the rich type system (that has its own mental cost), but removes the purity and the safety which are the the whole purpose of the exercise (or much of it, at least). I could go on and on (with macros, implicits and more), but Scala never fails to miss the mark. It adopts a feature without adopting the philosophy that makes the feature powerful. > Mutability and inheritance are good solutions to certain classes of problems, and it's valuable to have them in your toolbelt. Sure, but not if I have to pay the price of such a complex type system, that was designed for languages without mutability and inheritance! Each of these features is good in isolation, but combine them, and you get a mess. Scala is a the pizza-ice-cream-soup-steak-salad. Each has its place, but not as part of the same fucking dish! What is wrong with using one coherent language for one problem, and another for a different one? That's what Scala's designers don't seem to get. They simply have no taste. They're gluttons. I certainly wouldn't mind the generality if only the mental price I had to pay for it wasn't so high. A lack of guidance is not bad in and of itself - C offers no guidance and no guarantees, and is fit for many tasks - but combined with so many haphazard features and mind-boggling complexity, it becomes a liability rather than an asset. You end up paying the price for each of the features, but reaping few of the rewards. I think programmers are the last people this language is for. In fact, I think Scala is mostly made to amuse its compiler writers.
- virtualwhys 13y ago> There are so many problems with Scala, that the question of static vs. dynamic typing becomes secondary. Static typing could well be downright awesome, but Scala is still a mess. Well, gosh, it must be terrible, avoid it all costs! > I'm repeating the same line for the third time today. You're obviously not a fan of the language if you find yourself bashing it 3 times in a day, fair enough. > I find that Scala is for people who find Haskell too simple Scala is for those that want to get shit done without dealing with Java's endless boilerplate, while still running on the performance beast that is the JVM and benefiting from Java's massive ecosystem. As a bonus you get FP out of the box, so you find yourself, without consciously being aware of it, favoring immutable constructs (map,flatMap,fold, etc.) over imperative mutable boilerplate ridden hacks to achieve the same, thereby, in complete disagreement with the article at hand, becoming a better programmer. With Haskell you get purity, unhindered FP elegance, and minuscule ecosystem, a language interoperable with...itself it seems. While it's true that Scala is perhaps overly feature rich, with the to be released 2.11 the focus has been on aggressively stripping out unused features from the language and improving compiler performance. Following that, perhaps for 2.12, Odersky recently proposed on Twitter a revision of the type system that had FP devotees up in arms since the proposed change removes some of the complexity that makes libraries like Scalaz possible. At any rate, with Java8 there will be a squeeze in the JVM landscape, alternative languages will be fighting for users as lousy legacy Java is soon going out the window.
- pron 13y agoAll the features you've mentioned (which are the only features 99% of Scala's developers want or use anyway) are found in Kotlin, without the crazy complexity. So occasionally you'll need to cast a reference; so what? Scala doesn't enforce safety anyhow, so why spend so much effort on removing each and every cast? What you've described is what Scala programmers want Scala to be, or what they use; not what it really is. It seems to me that you've actually described Kotlin. BTW, I agree that the JVM is a tremendous asset. I develop for the JVM every day and I love it.
- eropple 13y ago> Scala doesn't enforce safety anyhow, so why spend so much effort on removing each and every cast? Because then the computer knows what I'm doing, and not just me. Whenever I write a cast, I am assuming I'm smarter than my computer--so smart I never, ever need the computer to check it. This is pretty stupid, because I'm not that smart. (Neither are you.) > What you've described is what Scala programmers want Scala to be, or what they use This is a pretty silly line of demarcation. Scala is what people use. So is JavaScript. There's no prescriptive use case for it. I'd like to like Kotlin, but it wasn't done enough soon enough and I now know Scala intuitively enough that there's no real reason for me to use it. It's just-different-enough from Scala to throw me, while being a step back down the continuum of expressivity. If Kotlin had come out three years ago, it might have grabbed me, but at this point it holds no value to me.
- deleted 13y ago[deleted]
- tmcneal 13y agoI think one of the points you're getting at here is that there's many different ways to solve a problem in Scala, versus something like Python. It's definitely true, as can be seen when comparing a codebase like Lift (https://github.com/lift/lift https://github.com/lift/lift) with Play (https://github.com/playframework/playframework https://github.com/playframework/playframework). Both are two MVC frameworks written in Scala but have vastly different coding styles. The company I work for is a Scala shop, and we've found success in codifying our coding style using the Scalastyle linter. The combination of a linter and peer code reviews has been very helpful for us in figuring out which language constructs and libraries we use and which we shy away from.
- cygwin98 13y agoSounds like what C++ shops used to do: enforcing a subset of C++, prohibition on anything else. However, each shop has its own subset.
- pron 13y agoYou've done a very sensible thing. Yet, I'm pretty sure that most if not all the features you've decided to use are found in Kotlin. I'm not saying you should use Kotlin, as it's not ready. I'm bringing it up to demonstrate that what people want from Scala and what its designers had in mind are two completely different things. What people want from Scala is Kotlin, but what its designers built is a Java-Haskell hybrid with macros. And there's a bigger problem. Do you shy away from Scala collections? Because I have no idea how the types works there, I didn't want to spend who knows how many hours just to understand how a simple list is coded, and I certainly wasn't going to use something I couldn't understand. So while you may easily understand your own code, I don't know if your team understands this simplest, most basic of libraries.
- Dewie 13y ago> For the life of me I can't understand what the language designers want, or how they think software should be written. From what I've read, that's exactly the design philosophy: we don't know what people will (eventually) want from our language, so we'll be sure to make it very extensible. And so the Scalable Language was made.