5 ms·
For me scala's feature set is absurdly big and there are always 10 ways todo things. Look at the spec of Scala. Its 200 pages long. That's insane. I'd rather u
by TeeWEE 6y ago
For me scala's feature set is absurdly big and there are always 10 ways todo things. Look at the spec of Scala. Its 200 pages long. That's insane.
I'd rather use Kotlin.
- pjmlp 6y agoYep, https://arrow-kt.io/ https://arrow-kt.io/ Just give it a couple of more years.
- mbo 6y agoThe Kotlin spec is... 275 pages: https://kotlinlang.org/spec/pdf/kotlin-spec.pdf https://kotlinlang.org/spec/pdf/kotlin-spec.pdf
- zaphirplane 6y agoYeah but the font ;)
- aphexairlines 6y agoAnd 796 pages for Java https://docs.oracle.com/javase/specs/jls/se14/jls14.pdf https://docs.oracle.com/javase/specs/jls/se14/jls14.pdf
- rgoulter 6y ago> For me scala's feature set is absurdly big and there are always 10 ways todo things. One of my favourite examples: of these 13 different ways of doing the same thing, only 12 are correct. https://nurkiewicz.github.io/talks/2014/scalar/#/22 https://nurkiewicz.github.io/talks/2014/scalar/#/22
- valenterry 6y agoHow is that a bad thing? It's the same in other languages and it is nice to have some flexibility. E.g. lisp: use whichever type of parentheses you want Or Kotlin: use short syntax lambdas fruits.filter(it == apple) or long syntax fruits.filter(fruit -> fruit == apple) or with annotated types: fruits.filter{fruit: Fruit -> fruit == apple} Sometimes brevity is good for the reader, sometimes more details are good for the reader. Not everything is a nail.
- misja111 6y agoThe flexibility is perfectly fine when you're programming something on your own. But when you're in a team, or worse, in a large company, it starts to be a problem that everyone can use their own style. It's much easier to read someone else's code when you have a common code style. And in Scala there are not only many different ways to use the standard libraries or to structure your code, there is a pure FP vs OOP-style FP schism as well. Because of this, you can qualify as a senior Scala developer for one job but only a junior in another.
- valenterry 6y agoThe opposite. If I write code on my own just for myself I use the highest level of brevity. But if I write code for a team, then in some places I will use explicit type annotations and variable names to aid people unfamiliar with the code to understand what's going on. What you are saying is pretty much "it's easier when everyone only uses nails, because then all I have to bring is a hammer". I think it's good to use screws sometimes. However, your second point I agree with. OOP vs. FP is a different story. This is about paradigms not about mere syntax. So here, a team must be aligned, which can be a challange when using Scala. It's not a language for corporate drones.
- tastyminerals2 6y agoIf it was so simple as just using explicit types :) And this sort of flexibility is exactly why Scala is hard to read. Perl is another example of a great language that allows you a lot of flexibility. In fact, the ability to use just any symbol for a method is the worst thing about Scala. You quickly realize it once you start using Scala libraries some of which basically introduce you to a new Scala based DSL. This quickly becomes a nightmare to work with if several such libraries are used in the project.
- valenterry 6y agoHave you used Scala before? I used both perl and Scala and I had to laugh when I read what you said. Yeah, Scala makes it possible to write cryptic DSLs. I just don't use libraries that do that, but there are not many such libraries anymore anyways, that was mostly abused in the early days of Scala. Now, 15 years later, that's almost non-existing anymore. But not having symbolic characters in method names is just horrible. Here is Java code that calculates some datetime: LocalDateTime started = LocalDateTime.parse("2018-03-22T19:00:00") LocalDateTime finished = start.plus(Duration.ofMinutes(30)).plus(Duration.ofMinutes(15).multipliedBy(4)).plus(Duration.ofSeconds(45)).plus(Duration.ofMinutes(4).multipliedBy(3)).plus(Duration.ofSeconds(30)) Here is the exact same calculation, but with Scala's "symbolic" characters: val started = LocalDateTime.parse("2018-03-22T19:00:00") val finished = start + 30.minutes + 4 * 15.minutes + 45.seconds + 3 * 4.minutes + 30.seconds I don't need very long to know what I find far more readable ;)
- dtech 6y agoI'd say that holds about as much value as criticizing C-style languages for allowing all these variants if(x) true if(x) true if(x) (true) if(x) {true} if(x) { true } if(x) { true } etc. In practice you use a linter to enforce a style and it's not a problem. For the curious. The combinations follow out of fairly simple rules: () and {} are interchangeable for expressions - altough {} can contain multiple statements and () only an expression. x op y is equivalent to x.op(y) Type abscriptions - x : Type - are optional and will be inferred if possible { case ... } is the pattern match construct and works similarly to a function with 1 parameter.
- trumpeta 6y agoIIRC one of Odersky's stated goal for Scala 3 was to address exactly this issue. That being said, it is developed in a research setting so I guess even if they restrict these features now, there will be new ones added over time...
- vvillena 6y agoScala has always been an opinionated language. The main difference is that this time is holding opinions against itself. Previously, opinions were held against Java, that's why there are features such as case classes, traits, and immutability by default. They answer to Java problems. Scala is now mature enough that some issues have emerged. Typeclasses are cool, but programming typeclasses in Scala is a bit clunky. The type system is very powerful, but it could be even more powerful and that would actually help people write simpler code. And there are a bunch of unused features that could be removed. This is what Scala 3 is about.
- aliakhtar 6y agoThis is like saying, airplanes are too complex. There are so many knobs and buttons. I'd rather just walk or ride a bike everywhere. Scala is a very powerful, very expressive language. There are some features which you can just choose to leave out. If you do, you end up with a very clean, concise, and powerful language that makes you really productive. I've literally had moments where I made my algorithm 5x faster just by adding 4 letters: '.par' in front of an operation. Instantly it got parallelized without my having to do anything, and the processing time got cut 5x.
- tastyminerals2 6y agoAnd that's why there are far fewer pilots in this world than stewards.
- TeeWEE 6y agoIts more like saying: I need to cut some paper ( i need to program): Swiss army knifes (scala) are too complex, I just need a pair of pair of scissors (lisp / other languages).
- aliakhtar 6y agoScala really isn’t that complex though. It’s actually pretty intuitive. You CAN write bad and hairy scala code just like you can in any language. But that doesn’t mean the language is to blame.
- pkolaczk 6y agoHaving switched from Scala to Python recently, I must say Python has probably 5x more ways to do things than Scala and I can't see people complaining on Python's complexity. This is something that really surprised me, because "one obvious way " was announced to be a part of Zen of Python.
- nsonha 6y agoand 0 way to do a lot of things
- esarbe 6y agoScala 3 tries to be more opinionated and goes quite some miles (kilometers?) to make the language more regular and simple. The implicits are gone, for example. Kinda crazy, since it was Scala's banner feature for so long. For the primary use-cases of implicits (extensions, type classes, conversion, ...) there are now language level concepts to make these use-cases accessible. "Intent over mechanism" I think Martin calls it.