Closed andyglow closed 1 year ago
I see. But still, would you be open to accept couple of PRs?
interfaces
that need to be implemented by members. Basically need to copy them exactly the same way you copy type parameters.
@DataEnum
public interface Expr_dataenum extends Serializable {
dataenum_case Lit(int i);
dataenum_case Sum(Expr_dataenum l, Expr_dataenum r);
dataenum_case Mul(Expr_dataenum l, Expr_dataenum r);
}
and another one. allow default methods on spec interface which won't affect the values
, but instead would be just copied to the base adt class
@DataEnum
public interface Expr_dataenum extends Serializable {
dataenum_case Lit(int value);
dataenum_case Sum(Expr_dataenum l, Expr_dataenum r);
dataenum_case Mul(Expr_dataenum l, Expr_dataenum r);
default int eval() {
return map(
lit -> lit.value(),
sum -> sum.l().eval() + sum.r().eval(),
mul -> mul.l().eval() * mul.r().eval(),
);
}
}
what do you think?
Yes, but we're not making a lot of active changes to it. It's been mostly used in Android projects, and there are very few remaining usages since we've been moving to Kotlin and sealed classes instead.