my funny old code
Jun. 16th, 2021 08:25 am![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
package scalakittens
/**
* A trait that describes a goodness of data or outcome or something
*
* Created by vpatryshev on 10/18/15.
*/
trait Goodness:
def isGood: Boolean
def isBad: Boolean = !isGood
trait PositiveAttitude extends Goodness { def isGood = true }
trait NegativeAttitude extends Goodness { def isGood = false}
no subject
Date: 2021-06-16 09:30 pm (UTC)def isGood: Boolean = !isBad
def isBad: Boolean = !isGood
no subject
Date: 2021-06-17 03:08 am (UTC)The only thing that should be mentioned is that, in that case, we gain some convenience by giving up some compiler guarantees. If we'd be able to force one of these methods to be implemented, it'd be way better.