What Scala Can't Do

What Scala Can't Do

Today, Scala is a programming language that can use any Javascript library, any Java library, and any C/C++ library through its multiple target system. You can create library bindings for Javascript libraries via ScalaJS, and you can even do so automatically is a library supports typescript with Scalably Typed. You can also use C libraries with Scala Native, or with the JNI.

Naturally, you might wonder if Scala can build JVM apps, work in the browser and on Node.js, and also do system level programming, what can't we do with Scala? It seems to address all major targets. We can built browser apps and do native programming; what more do we need?

Before we address that, let's talk about what you shouldn't do with Scala.

The Should Nots:

Android & iOS Development:

To start, people have tried this and succeeded. Years ago there was Scala tooling to develop Android apps, but it's long outdated and no longer maintained. There are also a few proof-of-concepts, but in general Android development with Scala isn't recommended for anything more than that. You won't be able to find any Scala first libraries that are still maintained, and in general you won't have much information to go off.

To contrast, iOS development. There are libraries for iOS development on the JVM like RoboVM. You also might be able to get Scala Native running on iOS, but it tends to be Linux centric. ScalaJS is a candidate with technologies like React Native, but again, I wouldn't recommend it. ScalaJS and React Native don't fit together tremendously well.

Desktop Apps:

The verdict is in, Java desktop apps are dead. You can build a desktop app through every target of Scala, but you probably shouldn't.

Scala Native can use gtk and other native libaries, but Scala Native isn't yet production ready.

Scala on the JVM can use JavaFX or Swing, but it's generally not a great approach to build desktop apps on the JVM anyway. There are far better alternatives at this point.

ScalaJS can use cross platform app tooling for Javascript, but again, I wouldn't recommend it.

The Can Nots:

Smart Contract Development:

You CAN built smart contracts for the EVM with Stainless. In fact, if I needed to write a smart contract, this is how I'd do it. But, for other targets, there just isn't the tooling necessary to develop smart contracts.

Various Low Level Systems:

Last year I experimented with the configurable robotics system Lego Mindstorm. I didn't like the official drag-and-drop programming model so I started programming the robot with its unique assembly language. Systems like these cannot be targeted by Scala.

Conclusion:

Scala is an extremely flexible programming language. I've never wanted to do something and been unable to use Scala. You can even do quantum computing with the Java Strange API. In general, you can do almost anything with Scala. The question you should be asking is whether or not you should be using Scala. There are competitive alternatives everywhere.

In short, use the right tool for the job.

要查看或添加评论,请登录

社区洞察

其他会员也浏览了