by BrannonKing · 2y ago · 0 comments
type State[TValue cmp.Ordered, TCost any] interface {
TransitionTo(context Context[TValue, TCost], value TValue) State[TValue, TCost]
... other methods
where Context is also a generic interface. I should add a TContext generic type to State instead of casting it inside my State implementation. It definitely leads to a proliferation of generic types being required on all methods that touch these things. I used to use Go for its terseness. Generics make it much less terse, but I like what they enable.No comments yet.