I'd like to suggest that format and formatToParts take a dictionary whose values are either unknown or instances of MessageValue. This allows two interesting use-cases:
- Pre-set certain formatting options on input values.
- Pass instances of custom types which extend
MessageValue.
Then, you'd first check if an un-annotated value is an instance of MessageValue. If so, carry on. If not, resolve to MessageUnknownValue. This way, you don't have to try to resolve every expression to a number and string first.
Originally posted by @stasm in #22 (comment)
I'd like to suggest that
formatandformatToPartstake a dictionary whose values are eitherunknownor instances ofMessageValue. This allows two interesting use-cases:MessageValue.Then, you'd first check if an un-annotated value is an instance of
MessageValue. If so, carry on. If not, resolve toMessageUnknownValue. This way, you don't have to try to resolve every expression to a number and string first.Originally posted by @stasm in #22 (comment)