#intellij-idea

[ follow ]
fromMedium
1 week ago

Scala 3 makes reserved word "new" optional

As a toy example, consider package org.example.graphicsobject WrappedColor { def apply(r: Int, g: Int, b: Int): WrappedColor = new WrappedColor(r, g, b)}import java.awt.Colorclass WrappedColor(r: Int, g: Int, b: Int) { val color = new Color(r, g, b)} Then we can write things like val wrapC = WrappedColor(128, 0, 255) Okay, seems like a lot of effort just to not have to write " new." But Scala programmers with a lot more sophistication than myself have been wanting this effort.
Java
Scala
fromMedium
4 months ago

Keep in mind that Scastie does not show Scala warnings

Scastie, the Scala REPL, does not display warnings; expect IDE warnings (for example, unnecessary semicolons) when copying code into IntelliJ IDEA.
[ Load more ]