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

"Diary Entry - January 18, 2026"

07:10

Reading Aristotle’s 10 Rules for a Happy Life - The Atlantic (link). Why there's always that strange tendency for journalist to a reference study from a psychology journal or a a science journal after everything? I'm not expecting Aristotle's views to supported by the APA, moreover, most of the links are really irrelevant, it's almost like he/she just needed to have some blue-colored words.

10:25 | There are two main problems with exceptions

The book Functional Programming with Scala mentions two main problems with exceptions:

  • Exceptions are not type-safe. The type of failingFn, Int => Int tells us nothing about the fact that exceptions may occur, and the compiler will certainly not force callers of failingFn to make a decision about how to handle those exceptions. If we forget to check for an exception in failingFn, this won’t be detected until runtime.
  • Java’s checked exceptions at least force a decision about whether to handle or reraise an error, but they result in significant boilerplate for callers. More importantly, they don’t work for higher-order functions, which can’t possibly be aware of the specific exceptions that could be raised by their arguments. For example, consider the map function we defined for List: def map[A,B](l: List[A])(f: A => B): List[B] This function is clearly useful, highly generic, and at odds with the use of checked exceptions—we can’t have a version of map for every single checked exception that could possibly be thrown by f. Even if we wanted to do this, how would map even know what exceptions were possible? This is why generic code, even in Java, so often resorts to using RuntimeException or some common checked Exception type.
  • As we just discussed, exceptions break RT and introduce context dependence, moving us away from the simple reasoning of the substitution model and making it possible to write confusing exception-based code. This is the source of the folklore advice that exceptions should be used only for error handling, not for control flow.

If I'd name a single thing that turns me down from using a certain language, it would be definitely exception handling. #Exception handling #Programming #Scala

11:22

Interestingly, Scala will prefer LUB type of an expression instead of doing a type union or doing Either , so:

  val result = if (true) "what?" else 4

result type here is Any instead of a union or Either type (like String | Int). Scala 3 solves a bit of this with type unions:

  val result: String | Int = if true then "what?" else 4

#Scala

12:44

Scala the good the bad and ugly. Most of the mentioned problems in "bad" were radically solved by the way the Go programming language was design. It's strange that in the last two decades, no language designers were able to design something strict that prevents these issues, other than the Go designers. #Scala

15:34

My dear God. Was that really necessary?

../i/15:34/2026-01-18_15-39-46_screenshot.png

Could we live without some 'magic'?

[permlink]
c. lr0 2025