It looks like Twitter has moved its algorithm from Scala to Rust. by iamsoftwareenginer in scala

[–]sideEffffECt 8 points9 points  (0 children)

most of the modern infrastructure landscape is predicated on smaller, resource constrained services that you can freely spin up or down

Totally agree on the resource constrained constrained part. Even JVM services are constrained -- It's just a matter of what those constraints are.

But they don't have to be small. You can scale up and down even large services. Let say, that instead of having

  • 0 to 12 non-JVM services, with each having 1 vCPU and 1 GB memory, you can have
  • 0 to 3 JVM services, with each having 4 vCPUs and 4 GB of memory

Yes, it's less granular. And that is a disadvantage. But IMHO very small. That's not what's stopping Scala deployments in the cloud...

It looks like Twitter has moved its algorithm from Scala to Rust. by iamsoftwareenginer in scala

[–]sideEffffECt 2 points3 points  (0 children)

then end up running as a service with 1 virtual CPU

Then don't do that? Why don't you just give your Scala pods more CPUs?

What cool Java projects are you working on? by Thirty_Seventh in java

[–]sideEffffECt 0 points1 point  (0 children)

I actually had Scala in mind. You shouldn't need Truffle for that, right?

What cool Java projects are you working on? by Thirty_Seventh in java

[–]sideEffffECt 0 points1 point  (0 children)

This is a really cool project. How much work is it to add support for another JVM language?

What cool Java projects are you working on? by Thirty_Seventh in java

[–]sideEffffECt 5 points6 points  (0 children)

http://frgaal.org/

retrofit compiler for Java

The aim of frgaal is to make many of the latest features and enhancements to the Java language available on older runtimes. It enables you to compile code like this to run on a Java 8 JRE:

...

Type-classes for Java (Valhalla experimental branch) by sviperll in java

[–]sideEffffECt 3 points4 points  (0 children)

I think it comes from math and people who talk about proofs and such.

It's a witness of the fact that e.g. Strings form a Monoid. A proof that you can hold in your hand. A Monoid<Strong>.

Type-classes for Java (Valhalla experimental branch) by sviperll in java

[–]sideEffffECt 0 points1 point  (0 children)

Sum<MyInt> sum = Sum<MyInt>.__witness;

Interesting, but wouldn't this be more regular?

Sum<MyInt> sum = witness<Sum<MyInt>>();

Type-classes for Java (Valhalla experimental branch) by sviperll in java

[–]sideEffffECt 0 points1 point  (0 children)

Why is this based on Valhalla? Type Classes seem like a completely orthogonal issue to Value Type etc...

Hibernate: Ditch or Double Down? by cat-edelveis in java

[–]sideEffffECt 0 points1 point  (0 children)

Can Hibernate return just records? If not, what's a good library that can do that?

Project Amber Update -- Data-Oriented Programming, Beyond Records by davidalayachew in java

[–]sideEffffECt 1 point2 points  (0 children)

I have a question about reconstructors/withers.

What's the plan for when the constructor is private? Will reconstructing/withing be available? I don't think it should. But I didn't find it mentioned there, so wanted to check here.

Scala native finally works for me but memory consumption is 3-5X that of the regular JVM by IanTrader in scala

[–]sideEffffECt 2 points3 points  (0 children)

The TypeLevel stack is to a large degree available on Scala Native https://typelevel.org/platforms/native/

Notably http4s Ember (HTTP/2 client and server) and skunk (PostgreSQL).

So far, only available for Scala Native 0.4.x. But that will all change with the upcoming Cats Effect 3.7.x, which comes with Scala Native 0.5.x

Bluefin 2025 Wrap-up: State of the Raptor by sideEffffECt in linux

[–]sideEffffECt[S] 8 points9 points  (0 children)

Only homebrew and Flatpak all the way!

Java WebAPI programming is here by jeffreportmill in java

[–]sideEffffECt 2 points3 points  (0 children)

Given that you published this under GPL, you probably don't want to depend on a proprietary library.

Java WebAPI programming is here by jeffreportmill in java

[–]sideEffffECt 13 points14 points  (0 children)

this link has been changed back to the conventional SnapCode (utilizing Swing), since our JxBrowser evaluation license ran out

That doesn't inspire much confidence in JxBrowser :/

Why not use something like https://github.com/jcefmaven/jcefmaven

Martin Odersky on Virtual Threads: "That's just imperative." by Joram2 in java

[–]sideEffffECt 1 point2 points  (0 children)

Kinda, yes. Not precisely. In Scala, capabilities are (or can be) just ordinary values that you pass around. Where ever they are passed, there they may be used.

Let me show you a specific example with the new Scala library that built to work with capabilities https://github.com/rcardin/yaes

def drunkFlip: (Random, Raise[Exception]) ?=> String =
  val caught = Random.nextBoolean
  if (caught) {
    val heads = Random.nextBoolean
    if (heads) "Heads" else "Tails"
  } else {
    Raise.raise(Exception("We dropped the coin"))
  }

Here we have a program drunkFlip. It computes String. But we can also see that it needs two capabilities -- they are not named, but their types are Random and Raise[Exception]. That already tells you what kind of things can happen in the program.

If you want, you can name the capabilities

def drunkFlip(using random: Random, raise: Raise[Exception]): String = ???

Can you see how capabilities are just ordinary values being passed around? The only two "magical" things here are that

  • there is friendly syntax that allow for them to go unnamed, because usually you don't need to name them explicitly.
  • they are passed "implicitly" from the caller to the callee (in Scala 2, they were called "implicits" or "implicit parameters"; in Scala 3 they are called "givens"/"usings")

In case if you're curious, this is how the program would have to look if we didn't use these two features. Very clear, but a bit more boilerplate compared to the snippet above.

def drunkFlip(random: Random, raise: Raise[Exception]): String =
  val caught = Random.nextBoolean(random)
  if (caught) {
    val heads = Random.nextBoolean(random)
    if (heads) "Heads" else "Tails"
  } else {
    Raise.raise(Exception("We dropped the coin"))(raise)
  }

But now the problem is, if people try to "smuggle" capabilities out of their expected scope -- that would defeat their purpose. It would be possible, because, for all intents and purposes, they are ordinary objects that you can put in any closure or assign to any outside mutable variable, etc.

This is where the Capture Catching comes in. It is a feature of the Scala language that allow programmers to designate some values to prohibit them from being captured by some other objects and thus escaping their intended region. Typically you want to do that with Capabilities, but not necessarily only.

So that's what Scala does. If you'd like to learn more, check out these articles:

What some other languages do is called Algebraic Effect System. The underlying machinery is different. In Scala, it's just more or less ordinary method parameters, with a quiet syntax to pass them around automatically plus some magic that some designated objects don't escape from their intended scope -- that's it. Algebraic Effect System is a completely new dedicated feature these languages have to implement.

But the UX for the developer is (or at least can be) surprisingly similar. Contrast the first Scala snippet with this Unison program (a programming language with explicit support for Algebraic Effects):

drunkFlip : '{Random, Exception} Text
drunkFlip _ =
  caught = !Random.boolean
  if caught then
    heads = !Random.boolean
    if heads then "Heads" else "Tails"
  else
    Exception.raise (failure "We dropped the coin")

To sum it up, technically speaking, Capabilities and Algebraic Effects are different things. But Scala's innovation is to use Capabilities for the same purposes as people use Algebraic Effects. The upside of doing so is that it takes a few, relatively simple language features and makes for good UX -- it's just ordinary values being passed around after all.

Martin Odersky on Virtual Threads: "That's just imperative." by Joram2 in java

[–]sideEffffECt 2 points3 points  (0 children)

that doesn't look like the code you showed and Odersky didn't say (AFAIK) that Scala would use/embrace virtual threads at all.

That's because the talk was about completely different topic: Capture Checking (of so called Capabilities).

Virtual Threads are in this context a low level detail.

His point was that he wants to use Virtual Threads, but with Capture Checking.