As Scala 3 allows to call constructors without using new
, I tried to remove all the new
keywords in a project of mine. However, I ran into a couple of issues:
- Objects cannot be constructed from type aliases without
new
. -
mutable.HashSet[Int]()
is not the same asnew mutable.HashSet[Int]
: The former builds from varargs, so creates a sequence and a builder. -
new mutable.ArrayBuffer[String](n)
(withn
an integer) won’t compile without thenew
.
I conclude that there are some loose ends. However, it is not clear to me what is intentional behavior, what is a bug, and whether some changes to the language and/or the standard library may be necessary to improve user experience.