News for hackers. Stuff that matters.
Re:Towards Scala 3 by mavdi on Friday April 20, 2018 @08:49AM (#16884304)
> Simplify where possible

> eliminate inconsistencies and surprising behavior

Oh dear god please.

Re:Towards Scala 3 by realusername on Friday April 20, 2018 @09:06AM (#16884402)
I know on HN people like Scala but it's by far one of the language I hated the most when I worked with it. It's the complete opposite of Go, every time the Go team said no to a random feature, the Scala team said yes to that random feature. Scala feels to me like a kind of functional Perl.
Re:Towards Scala 3 by willtim on Friday April 20, 2018 @09:18AM (#16884479)
The Scala team appear to have their hearts in the right place. They seek to empower their users and have respect for them. I can't really say the same about the Go team, based on at least one Google presentation I have seen. This isn't that surprising given the goals of the projects.
Re:Towards Scala 3 by realusername on Friday April 20, 2018 @09:29AM (#16884564)
I did not want to start a flame-war Scala vs Go, it's just that I like Go simplicity & readability (I also like Python and Ruby for those reasons as well) whereas I'm not a huge fan of the Perl feeling of Scala.
Re:Towards Scala 3 by willtim on Friday April 20, 2018 @09:45AM (#16884687)
When there's no ability in the language to abstract, there's no abstractions to learn, beyond what is built in. But this is not a blessing, it means we have to study every line of code and hope that we can uncover some emergent higher-level structure, if it exists.
Re:Towards Scala 3 by realusername on Friday April 20, 2018 @09:50AM (#16884723)
> hope that we can uncover some emergent higher-level structure, if it exists.

That's exactly what I feel when I read Scala code, everything is a soup of custom operators, implicits and objects disguised like functions (or the opposite, you think it's an object but actually it's a function), it makes the code very hard to maintain and read. At least with Go, Python or Ruby your logic is in plain English, that makes it much easier.

Re:Towards Scala 3 by lmm on Friday April 20, 2018 @10:30AM (#16885026)
I find the opposite. With Scala my logic can be plain English written in the language of the domain, because Scala makes it very easy to push out secondary concerns like authentication or audit logging or error handling out into the type system where they're still there, still managed, still checked by the compiler, still visible on mouseover/click-through in my IDE, but they don't have to obscure the straight-through happy-path business logic. Whereas in Go, all the secondary logic has to be right there, which clutters up the code and makes it harder to see the primary thread, and in Python or Ruby either you do the same thing or else the secondary logic has to work by invisible magic (metaclasses, exceptions, method_missing...) and you have no hope of ever being able to understand what's actually going on.
Re:Towards Scala 3 by seanmcdirmid on Friday April 20, 2018 @10:22AM (#16884966)
This is analogous to the tension between “worse is better” and “perfect is the enemy of good.” One the one hand, elegance is impossible and one must settle early on inelegance. On the other hand, elegance is possible but one must be clever and spend a lot of time looking for it. These trade offs are really apparent in competing language designs (Scala, Go) and it isn’t clear which ones are the better ones to make.
Re:Towards Scala 3 by dragonwriter on Friday April 20, 2018 @09:47AM (#16884704)
Right: phrased differently, weaker abstraction power means recurring problems have to be addressed by documenting patterns with fill-in-the-blanks recipes, instead of reusable code libraries.
Re:Towards Scala 3 by 62747478182 on Friday April 20, 2018 @12:55PM (#16886430)
You said [Scala] it's by far one of the language I hated the most. If you don't want to start a flame-war maybe you should change the tone of the comment.
Re:Towards Scala 3 by icedchai on Friday April 20, 2018 @11:43AM (#16885712)
I share the same opinion of Scala. It definitely feels like it has too many features and is too complicated.

Back in 2010 - 11, when I last worked with it, the compiler was also dog slow and IDE support was terrible. No doubt this has changed for the better, but it did ruin the language for me. I'll stick to Kotlin and Java, thanks.

Re:Towards Scala 3 by lmm on Friday April 20, 2018 @09:34AM (#16884607)
Can you be specific? This is a popular meme but it doesn't match my experience of Scala's language features at all (indeed I'd say Scala is very good at pushing things out into libraries or composition of existing features rather than making them language features), and often I find people with this kind of complaint were actually using a library with poorly named functions and mistaking its features for language features.
Re:Towards Scala 3 by realusername on Friday April 20, 2018 @09:44AM (#16884672)
I would start with operators and operator overrides, most of the time they don't make sense and it's difficult to know what it does, that's why most other languages banned them.

Secondly, the implicit concept makes the code difficult to read. Then I would add that the differentiation between function & variable isn't always clear and sometimes you don't know what you call.

Re:Towards Scala 3 by lmm on Friday April 20, 2018 @10:18AM (#16884939)
> I would start with operators and operator overrides, most of the time they don't make sense and it's difficult to know what it does, that's why most other languages banned them.

Yeah, that's what I was talking about - in Scala operators are just functions, and badly named operators are an issue with some libraries rather than an issue with the language. They're unfortunate, but all one can really do is avoid them - no language is impossible to write bad libraries in. Certainly I wouldn't ever want to go back to a language that uses magically-named methods for operator overloading, like Python and Kotlin do - I find that far more confusing, I can never remember whether a * b is calling a.__times__(b) or a.__star__(b) or something else. I could get behind a language that disallowed symbolic names entirely, but I don't think I've seen one of those since Java.

> Secondly, the implicit concept makes the code difficult to read.

IDE support has gotten a lot better now (green underline to highlight any implicit conversion, expand out implicit parameters) which makes them much easier to work with. If you only use implicits in cases where you otherwise wouldn't do anything in code at all, they enhance readability - but of course if you use them to replace things that you'd otherwise make explicit then they can reduce readability. I don't have a good answer, because I definitely want extension methods, typeclasses with derivation, and the magnet pattern, but I haven't yet seen a language design that makes those things possible while disallowing the bad uses of implicits.

Re:Towards Scala 3 by dionian on Saturday April 21, 2018 @11:10AM (#16891694)
most of these criticisms I agree with but I don't blame scala as a language for it. I write, and encourage my colleagues to write, code that is very easy to follow and reckon about. Few obscure operators, almost zero implicits....
Re:Towards Scala 3 by coryfklein on Friday April 20, 2018 @10:56AM (#16885265)
What IDEs support this behavior?
Re:Towards Scala 3 by lmm on Friday April 20, 2018 @11:15AM (#16885436)
Both eclipse and intellij will underline implicit conversions. Showing implicit parameters might be intellij-only.
Re:Towards Scala 3 by yawaramin on Friday April 20, 2018 @11:04PM (#16889784)
Emacs + ENSIME also underlines implicit conversions.
Re:Towards Scala 3 by Cyph0n on Friday April 20, 2018 @10:58AM (#16885282)
Most uses of operator overrides in the Scala standard library make complete sense.

Want to add a value to a (mutable) Seq? Use +=.

Want to add a value and return a new Vector? Use +.

Want to build a new list that is the concatenation of two Lists? Use ++.

sbt is probably where you encountered "weird" operators, but their use has declined over the past few years from what I've seen.

Re:Towards Scala 3 by _Codemonkeyism on Friday April 20, 2018 @09:26AM (#16884541)
Scala is not for development, it's a research project.
Re:Towards Scala 3 by dang on Saturday April 21, 2018 @03:26PM (#16892920)
Please don't post flamebait to Hacker News.
Re:Towards Scala 3 by _Codemonkeyism on Wednesday April 25, 2018 @08:49AM (#16921008)
Foursquare lib migration to Scala 2.12, open since one year, we can't upgrade to 2.12 because of that dependency,

https://github.com/foursquare/fsqio/issues/37

They don't upgrade the open source version because their internal version depends on that open source version and they don't can't upgrade internally to 2.12.

They can't upgrade because of several dependencies of their own, the last one Finagle.

All of those although "cross compiles are no problem" as the default answer from the Scala development team on these issues.

Re:Towards Scala 3 by sulam on Friday April 20, 2018 @09:51AM (#16884747)
I don’t know is this is a good troll because I’m replying or a bad troll because it’s so obvious.

There are Many people who work at many companies doing real development with Scala that goes all the way to production, handling real user traffic.

Re:Towards Scala 3 by _Codemonkeyism on Friday April 20, 2018 @10:13AM (#16884905)
Yes we use Scala in production for >6 years.

But I wonder how many companies would make the same decision again after their experience with Scala.

Re:Towards Scala 3 by simon_o on Friday April 20, 2018 @09:32AM (#16884592)
Not going to happen.

I assume that the "added feature" section of the Dotty documentation and this blog entry have been written by different persons, because it's utterly impossible to reconcile those documents:

More complicated features, more experiments, more NIH, more ad-hoc inventions, larger language footprint with more inconsistencies and surprising behaviors.

Re:Towards Scala 3 by MrBuddyCasino on Friday April 20, 2018 @09:08AM (#16884423)
Also, no plans to get rid of implicits apparently. Sorry Scala, we're not gonna be friends.
Re:Towards Scala 3 by pul on Friday April 20, 2018 @09:15AM (#16884461)
Not fully, but implicit type conversion must be marked explicitly: https://medium.com/bigdatarepublic/key-takeaways-from-the-sc...
Re:Towards Scala 3 by modersky on Friday April 20, 2018 @10:00AM (#16884808)
Re:Towards Scala 3 by Cyph0n on Friday April 20, 2018 @09:24AM (#16884523)
Implicits are very powerful when used correctly, but are terrible if not.
Re:Towards Scala 3 by MrBuddyCasino on Friday April 20, 2018 @09:46AM (#16884694)
If "<feature> is very powerful when used correctly, but terrible if not": think long and hard before adding to a language.
Re:Towards Scala 3 by lmm on Friday April 20, 2018 @10:26AM (#16884997)
Completely agreed. Implicits are the one place where Scala genuinely pushes the art of language design a bit beyond what's really possible; I expect future languages to come up with a better solution to the same problem. But in the meantime the things they enable - typeclasses, extension methods, the magnet pattern - are too valuable to do without, and we can't just sit around and wait for the perfect language to arrive.

I wouldn't want to have any more language features that pushed as hard as implicits do, but one somewhat-experimental feature in a language is ok, just about. I don't think Scala is a thousand-year language, but it strikes the best balance given the current state of the art.

Re:Towards Scala 3 by yawaramin on Friday April 20, 2018 @11:08PM (#16889793)
Typeclasses: barely workable–if the implementor knows how to save the caller from paying the 'import tax'

Extension methods: too much potential for confusion

Magnet pattern: no idea what that is

Personally I feel OCaml strikes the best balance :-) But we may be arguing about an inch here rather than a mile.

Re:Towards Scala 3 by dionian on Saturday April 21, 2018 @11:11AM (#16891696)
which is why I'd be against adding them in Java and favor keeping the power in scala.
Re:Towards Scala 3 by YorkshireSeason on Friday April 20, 2018 @01:42PM (#16886829)
What is your main complaint with implicits?

If you don't like them, why don't you add "Use of implicits forbidden" to your coding style guidelines, and check in code-reviews, and add a "grep implicit" check to your CI setup that refuses to commit Scala code with implicits?

Let me paraphrase M. Odersky's PLDI 2017 keynote:

   The essence of Scala is implicits
You can find it at https://www.youtube.com/watch?v=br6035SKu-0
Re:Towards Scala 3 by philipwhiuk on Friday April 20, 2018 @06:17PM (#16888833)
> If you don't like them, why don't you add "Use of implicits forbidden" to your coding style guidelines, and check in code-reviews, and add a "grep implicit" check to your CI setup that refuses to commit Scala code with implicits?

Because Scala libraries that do useful stuff are infested with them. Akka loves the things.

> main complaint

They obscure complexity, pretending that complex stuff is simple. It makes simple stuff trivial but complex stuff harder.

Re:Towards Scala 3 by YorkshireSeason on Saturday April 21, 2018 @05:11AM (#16890644)
> Akka loves the things.

So? Treat Akka as a black box. You can always explicitly pass implicit arguments.

Re:Towards Scala 3 by MrBuddyCasino on Saturday April 21, 2018 @10:21AM (#16891512)
"If you don't like them, why don't you add "Use of implicits forbidden" to your coding style guidelines, and check in code-reviews, and add a "grep implicit" check to your CI setup that refuses to commit Scala code with implicits?"

Only someone who has never worked in a team before would suggest this.