Def and Val in Scala constructors
TL;DR – use def all the time, and things just work. Remember that old adage from Java, “Never call a nonfinal method in your constructor”?Yeah, that still applies in Scala, and it keeps biting me. It’s easier to get wrong in Scala. Here’s a refresher:When a class is instantiated, the superclass is initialized first. Its …