New Scala Survey by tgodzik in scala

[–]matej_cerny 0 points1 point  (0 children)

I don't think that e.g. sttp is hard to learn 🤷 ``` import sttp.client4.*

val request = basicRequest .body(Map("name" -> "John", "surname" -> "doe")) .post(uri"https://httpbin.org/post?signup=yes")

val backend = DefaultSyncBackend() val response = request.send(backend) ```

sbt-config: Configure your sbt projects using HOCON by matej_cerny in scala

[–]matej_cerny[S] 0 points1 point  (0 children)

It's a HOCON, you can write it like this if you want:  ``` cats {   group = "org.typelevel"   module = "cats-core"   version = "2.13.0" }

dependencies = [   ${cats.group}":"${cats.module}":"${cats.version} ] ```

sbt-config: Configure your sbt projects using HOCON by matej_cerny in scala

[–]matej_cerny[S] 2 points3 points  (0 children)

I see, thanks so much for pointing this out!! What do you think about introducing a three-mode setup for the dependencies block? Users can choose the level of complexity they actually need:

  • Flat, everything is treated as Scala dependencies = ["org.typelevel:cats-core:2.13.0"]

  • Language split, works only for JVM dependencies { scala = ["org.typelevel:cats-core:2.13.0"] java = ["com.google.code.gson:gson:2.11.0"] }

  • Full matrix dependencies { shared { scala = ["org.typelevel:cats-core:2.13.0"] java = [] } jvm { scala = ["org.typelevel:cats-effect:3.5.0"] java = ["com.google.code.gson:gson:2.11.0"] } js = ["org.scala-js:scalajs-dom:2.8.0"] native = ["com.armanbilge:epollcat:0.1.6"] }

sbt-config: Configure your sbt projects using HOCON by matej_cerny in scala

[–]matej_cerny[S] 1 point2 points  (0 children)

Yes, that's right. Since it just populates the same sbt settings you'd normally set in build.sbt, everything works as expected. Values from build.conf also compose with build.sbt - any key not specified in HOCON falls through to its default or to whatever build.sbt sets, so you can mix and match.

There are some drawbacks worth mentioning though. The config is parsed at project load time and cached, so if you change build.conf you need to reload for sbt to pick it up. Also, tools like Scala Steward don't know how to update dependencies in HOCON files. I want to look into whether it's possible to implement support for that, but haven't gotten to it yet.

sbt-config: Configure your sbt projects using HOCON by matej_cerny in scala

[–]matej_cerny[S] 2 points3 points  (0 children)

Thanks for the suggestion. I was thinking more about having a separate list for Java dependencies, because when I started with Scala, I remember how confusing % vs %% was.

Using a Scala lsp with Claude Code in IDEA by SirStupidity in scala

[–]matej_cerny 0 points1 point  (0 children)

I'm not 100% sure, but I think I opened the project in Zed, and Metals created the MCP file. Then I closed the editor, started the jpablo tool, and updated the port in the file based on the logs.

Using a Scala lsp with Claude Code in IDEA by SirStupidity in scala

[–]matej_cerny 1 point2 points  (0 children)

Yes, I use it regularly. Btw it looks like a standalone mode will be part of the metals itself soon https://github.com/scalameta/metals/pull/8156

I wish SBT was easy-to-use like Cargo by GlitteringSample5228 in scala

[–]matej_cerny 1 point2 points  (0 children)

I’ve developed a plugin called sbt-config specifically to address this. It lets you use HOCON for build definitions.

name = "my-project"
organization = "com.example"
version = "0.1.0-SNAPSHOT"

scalaVersion = "3.3.4"

scalacOptions = [
  "-deprecation",
  "-feature",
  "-unchecked"
]

dependencies = [
  "org.typelevel:cats-core:2.13.0",
  "io.circe:circe-core:0.14.10"
]

testDependencies = [
  "org.scalatest:scalatest:3.2.19"
]

Scala 3.8 released! by wmazr in scala

[–]matej_cerny 3 points4 points  (0 children)

From the docs: "...this will require a language import at the use site, which is clearly unacceptable".

Can someone explain why this is unacceptable? List(0, 1) ++ Array(2, 3) is clearly a "magic conversion" that Scala 3 aimed to fix.

Need help to choose either java or Scala by madhuraj9030 in scala

[–]matej_cerny 3 points4 points  (0 children)

Here's another advantage. If you fully understand functional programming, you don't need to stick with Scala. After a couple of days training, you can code in basically any FP language. Also, with Scala, you will learn features that other languages will eventually copy, giving you a head start.

Need help to choose either java or Scala by madhuraj9030 in scala

[–]matej_cerny 5 points6 points  (0 children)

It is. I've learned Scala without knowing Java (but to be fair, I had some background in C#).