In asking for help with an application, I wondered aloud in text whether (or perhaps assumed) it were possible to have:
trait DisplayType1 { ... }
trait DisplayType2 { ... }
// ...
and then somehow register that {:T1}
and {:T2}
should be handled by those traits.
cf. “The current mapping of types to traits”
In my case, I wanted for a CLI to have a human-readable ‘pretty’ output (OK, Display
works fine here) as well as JSON output (that should be different to Debug
) and perhaps others in the future (e.g. one might imagine YAML, none, coloured, not).
It was suggested that I bring this up here, so here I am. (Note I’m not here to repeat my ‘what should I do’ question, just to identify a use case for something like this in the language.)