vita nouva / diary
"The Rose Garden by Carl Aagaard"
14/01/2026

2026/01/14

03:08 Scala's multiple parameters

Multiple parameter lists are weird in Scala. I could only think of a good use of them as:

// by Knut Arne Vedaa
// Retrieved 2026-01-14, License - CC BY-SA 2.5

scala> def foo(as: Int*)(bs: Int*)(cs: Int*) = as.sum * bs.sum * cs.sum
foo: (as: Int*)(bs: Int*)(cs: Int*)Int

scala> foo(1, 2, 3)(4, 5, 6, 7, 9)(10, 11)
res7: Int = 3906

Scala author suggest it's useful with complex type inference situation, but I can't think of any. #Scala #Programming

11:14 Scala's exceptions

Apparently Scala handles exceptions pretty well, and you can even have kind of a type-safe partial-functions using something like the Try call. #Exception handling #Scala

15:22 Scala's companion types

One of the things some websites add as a reason to use companion types in Scala, is that not having the "new" keyword is cool. Since when we drop language specifications on their level of coolness? #Scala

[permlink]
c. lr0 2026