What can make scala more popular?

Yep, me too. But for that I think we need (and we indeed have) vastly different APIs than typical imperative ones from Java. I rarely interface with Java frameworks nowadays, but when I do I feel they do not want to enrich type system to enhance safety. Instead of e.g. having type safe builders or configurations we have type-unsafe ones. E.g. there are 10 setters on a type (let’s call them setter1, setter2, …, setter10) and a build or start method. I have to use a subset of those setters but types don’t guide me which ones. Therefore I e.g. use setters 1, 2, 3 and 8 and then only after running the code I get an exception which I’m googling and finding out I had to run setter7 not setter8 in this case.

Before improving integration with some Java APIs we should consider whether we want to promote those APIs in Scala. Maybe there already viable alternatives in Scala that are more type-safe, concise and composable.

3 Likes

That exists – I think it predates the IntelliJ one, although I’m not sure. I used it for a good five years, personally.

But having used both, I have to disagree with the premise: the IntelliJ plugin is much better-maintained than the Eclipse one. This isn’t surprising – IntelliJ costs a fortune, whereas Eclipse is free and supported by a few over-worked volunteers. I wound up switching to IntelliJ a year or so ago, after having been one of the few holdouts on Eclipse. So while, yes, I suspect that Kotlin is the higher priority for them, IMO JetBrains does a reasonably good job maintaining its Scala plugin, and I’m surprised by the comments otherwise.

(Mind, I’ll probably switch to Metals/VSCode before long, and I look forward to Scala 3’s built in support for LSP. But IntelliJ’s pretty decent.)

1 Like

Ok, thanks for the info it’s news to me! Hopefully this thread will help others find it here;
https://marketplace.eclipse.org/content/scala-ide

All of the Scala tutorials I have viewed do start with ‘download IntelliJ’!

I was just relaying hearsay of what I heard, I apologize if I was proliferating misinformation!

It may have since been superseded by Kotlin, as part of the Android tooling; but last I spoke to the IntelliJ folks, Scala support was their most heavily downloaded plugin by a significant margin.

However much they want to support their own language, I can’t see them ignoring such a large audience of people who are downloading, using, and paying for the product in order to use that plugin.

I’ll also note that I see it regularly updated. Just a few months ago there was a major enhancement to the way it displays inferred type information. So the strong Scala support in IntelliJ won’t be going away any time soon.

1 Like

For me the answer is obvious - normal (fast and convenient) numeric and dataframes libraries are missing. I constantly have to switch to python because it is impossible to do anything useful numerically in Scala, scala breeze is less flexible than numpy and lacks many features. In terms of dataframes only Spark has some dataframes features but it is too heavy for most of the tasks and fails miserably for many use-cases (like having very wide dataframes or transposing dataframes).

2 Likes

On the subject of what makes a language popular this is a pretty interesting talk: https://youtu.be/QyJZzq0v7Z4

1 Like

I agree that it would be easy to misinterpret.

There is intresting statment there, it is somethink like:

  • Performance does not influence on popularity.

IMHO: It is half of true which can easily lead to leaky abstractions.
Here is an interesting message:Linus Torvalds on C++
The real problem of C++ is not the complexity. It is amount of leaky abstractions.
So it is very important making scala more simple and light, but if it leads to a leaky abstraction it will not be good. For example I do not think that data processing with performance of dynamic languages is good thing. A good dynamic language always has more killer features in such situation.

1 Like

Most abstractions are not about improving performance. Quoting Wikipedia:

.

A few percent of method calls in Java are megamorphic, thus the HotSpot JIT is not able to devirtualize them, so they more or less have “performance of dynamic languages”. Are Java programmers avoiding megamorphic calls? I think almost none of them even know what it is, let alone care about it (how often do you check if your method calls are megamorphic?). Java is fast enough to not care. JITed pure Java code is orders of magnitude faster than interpreted pure Python code, even with few percent of method calls being slow.

Take for example std::sort from C++ STL. It is generally fast, but it’s not hard to write significantly faster sorting algorithm for your particular use case (I’ve done it many times). Are people doing that? Usually not, because std::sort is fast enough for most people.

You would have to reject most abstractions if the possibility of writing noticeably faster manually optimized code is a reason for abstraction rejection.

A killer feature of dynamic language, besides killing performance is also killing static analysis. With fully dynamic typing you don’t have automated refactoring, navigation, static error checking, auto-completion etc Of course you can add type inference to your tools (and restructure your code to make those tools work well), add type hints to your code, but if you do it seriously then why not to switch to a language that has type inference and static analysis as a first-class features?

2 Likes

I can say more simple if scala had performance of python in practice I would choose python. Static language with practical performance of dynamic one is bad design. I use leaky abstraction for stuff which lead to bad design. I will be glad If you propose me something better

Scala performance is close to Java and will stay that way. OTOH, there are usage scenarios where Python has comparable performance to Java, e.g. parsing text using regular expressions (as they are implemented using C code in Python) or invoking natvie methods and executables (i.e. writing glue code). Does Java need to be multiple times faster than Python in everything to be considered an improvement?

I am glad to hear it.
https://contributors.scala-lang.org/t/discussion-about-structural-types-index-based/
I hope I have been able to explain why I think that structural types should be index based at least to big data.

  1. Records were never meant to be index based, thus there’s no abstraction leak.
  2. Pinpointing problems is much easier than pinpoining solutions. I have told you about megamorphic methods. Devirtualizing them efficiently would improve overall performance of Java, Scala, Kotlin, etc to a much higher extent than exotic features like records.
  3. Nobody has any idea how index-based polymorphic records are supposed to work in the compiler (I’m actually curious about that), but you somehow tell that it’s obvious and refuse to elaborate on the idea or even provide complete working code that needs improving.

I guess complaining is everything you can do (yeah). You need to shift the energy to properly describing your idea instead.

that’s why we just don’t use them :slight_smile:

I just do not want to be trolled. there are no direct question which have not been tried to answer by me.

So I try to avoid such discussion. It is obvious :slight_smile:

I better follow the Martin’s advice:

  • If we take us as individuals, the answer is that we can and will stop interacting with people whose behavior we object to.

So if some questions seem suspectible for me, I will not insist on continuing discussion. If someone regularly provocates me instead of making a good question or proposal I do not understand why I owe him something.

I’ve stated them in a post above yours:

Somehow asking for complete working code to improve upon is asking too much. It seems you have http://xyproblem.info/ - we don’t see the original problem (i.e. code that can be improved), but instead you’re asking us to finish your obscure solution.

2 Likes

It is not too much, but I can reject your asking without any blaiming if I think it has no sense. Can I have my own opinion…

You can open and read CoC. It has been violated too much, let’s stop.

1 Like

This style of debate is not encouraged here and this thread has gone completely out of topic. Please, keep your comments concise and on point.

8 Likes

I’m coming late to this discussion and I admit to have skipped many of the comments (encouraged by @jvican 's last comment), so I might repeat some of the proposals that have been discussed already.

Let me start with some more practical ideas. These may be obvious and already being worked on, but I feel like it’s worth mentioning them anyhow:

  1. Reduce compilation time. I believe this is the number one reason developers refrain from using the language.
  2. Target popular IDEs other than IntelliJ. Eclipse, VSCode, etc.
  3. Add support for popular online REPL, such as https://repl.it
  4. Add guides / tutorials / courses in popular educational websites, such as https://www.codecademy.com/

There is also one more strategical concept that I believe needs to be adopted, and that is better catering Scala for Java developers.

Java is one of the most popular languages out there, and it is closely related to Scala, especially when it comes to technicalities and migration efforts. I strongly believe that targeting Java developers as potential Scala newcomers is the way to go.

How does one cater for Java? Primarily, by fully adopting many of Java’s already existing libraries and tools as part of the Scala ecosystem, treating them as first-class tools and not second-class. Scala does not need another testing tool, another mocking tool or another build tool. There is no problem having these around, but they should not be the go-to solutions, and should not be the focal interest of the community. The Java counterparts are more mature and have a bigger community, and they work well with Scala.

One of the biggest examples for this is the outdated support for Scala in Gradle – one of the more popular Java build tools. This is only being addressed now, and not by any of the community “leaders”, but rather by Gradle Inc itself. Instead, the community seems focused on adopting Mill, which is in such an early stage that it doesn’t even run JUnit tests, making it largely obsolete for Java-Scala projects.

1 Like

While I understand and sympathize with this viewpoint, I don’t really agree, for a couple of reasons.

First, the separate Scala tools didn’t come out of nowhere – they evolved because the existing Java tools didn’t work as well as one might wish in the Scala context. For example, you say:

I don’t think that’s true. ScalaTest is easier to use for idiomatic Scala code than JUnit is – there’s less boilerplate, and it leverages Scala’s power to do a lot of cool things easily. And ScalaCheck is hella powerful, and remarkably easy to use.

Mockito, IMO, is terrible for Scala code (we do use it a moderate amount, and I spend too much time helping fix problems caused by it), because it is fairly weakly-typed and null-centric, both of which are a poor match for Scala, so the resulting tests tend to be brittle. (Granted, ScalaMock isn’t perfect either, but it’s at least better-typed.)

sbt, for all folks complain about it, became popular because folks found the common Java alternatives painful to maintain big Scala projects. I know several people who have tried the Java alternatives because they were so annoyed at sbt, and wound up coming back to sbt afterwords because they found it the least-bad option.

Not to mention that Scala now runs on platforms that Java doesn’t. You must use Scala’s own test tools if you’re going to test cross-platform, which many projects do nowadays. Scala’s environment is now a superset of Java’s, so the Java ecosystem doesn’t cover all of its needs.

I think you’re coming at this from a somewhat Java-centric viewpoint, and that was once absolutely central for Scala – but the world has moved on. When I’m training up new folks, they’re as likely to come from a background of JavaScript, or Python, or Ruby as they are from Java. (Personally, I came from C#.) When you are coming at Scala from Java, it seems weird to see “redundant” tooling like this; but when you aren’t, the Scala tooling (IMO) looks more appropriate and focused on the task at hand than its Java counterparts.

The different toolsets does make it more of a challenge for Java-centric companies to adopt Scala – the same way it would be a challenge for them to adopt Ruby or C# or whatever. But I’m skeptical that it is much of a challenge for individual engineers to pick up Scala. I’ve been training up a bunch of Java folks recently, and all of them have picked up the Scala tooling quickly, easily and enthusiastically. So one shouldn’t over-estimate this issue.

I’ll totally grant that Scala’s homebrewed tooling hasn’t been historically as mature and robust as we’d like. But the community has woken to that in the past couple of years, and tooling development has gone from being an afterthought to being pretty front-and-center. I’ve been really happy to see the rapid and dramatic improvements of everything from sbt to editor support over the past couple of years. There’s still a long ways to go, but it now feels like we’re getting to the point of having an ecosystem we can be proud of, which suits Scala well.

I think that’s an overstatement, although an understandable one. Folks talk about Mill a lot, because it’s New and Cool, and in some ways is easier to understand and more easily-powerful than sbt. But I’ve seen relatively little Mill usage in the wild yet. We’re only using it for one of our hundreds of Scala projects – and that only because it’s a fork of uPickle, which was already using Mill.

I think Mill might eventually become one of the dominant tools, but I believe adoption is still pretty modest at this point, and growing slowly. It is early-stage and somewhat immature, everyone knows that, and it’s going to take a while (if ever) before any sort of critical mass of projects moves to it…

6 Likes

I came from Java, and ScalaTest was a selling point, not an obstacle. JUnit only felt easy to use because I wasn’t exposed to better alternatives, and I feel that adopting it as the testing library would be a huge step backwards.

4 Likes