3 ms·
This is where I start to like Scala's traits. Being able to declare a class "with logging" and automatically get a pre-configured loger handle with no extra cer
by bunderbunder 8y ago
This is where I start to like Scala's traits. Being able to declare a class "with logging" and automatically get a pre-configured loger handle with no extra ceremony needed, is really convenient.
It's also unprincipled as heck, from both an object-oriented and a functional perspective. I think my alignment in the logging department might be chaotic good.
- default-kramer 8y agoNice, I don't do much Scala so I never thought about using traits for that! Is that a common pattern? It seems similar to traditional OO dependency injection, except without all the ceremony of adding a constructor parameter and corresponding class member to hold it.
- bunderbunder 8y agoI'm not entirely sure how common it is. It's a case of multiple implementation inheritance, so I could see a lot of people balking at it.