I want to define traits (I don’t know so much about traits but perhaps traits). I know 2 ways.
Abstract type and subtypes:
abstract type YAMLVersion end
struct YAMLV1_1 <: YAMLVersion end
struct YAMLV1_2 <: YAMLVersion end
forwardchars!(::YAMLV1_1, stream::TokenStream, n::Integer=1) #...
The first version is definitely more common, and what I would use most of the time. I’m really not sure why RoundingMode uses the struct method, I would guess it’s to solve a specific and niche problem.