Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make MessageValue subclassable and allow passing it as input variables #24

Open
stasm opened this issue Aug 18, 2023 · 1 comment
Open

Comments

@stasm
Copy link
Contributor

stasm commented Aug 18, 2023

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:

  1. Pre-set certain formatting options on input values.
  2. 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)

@eemeli
Copy link
Member

eemeli commented May 7, 2024

Currently, the proposal allows for inputs with object values (for example, see step 7 of MessageFormat Number Functions) that may have a valueOf() method and an object property.

Is that sufficient to serve the use cases presented here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants