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

NeoFormatter --> Formatter #5683

Closed
wants to merge 2 commits into from

Conversation

sffc
Copy link
Member

@sffc sffc commented Oct 14, 2024

#1317

Also hides the neo module, making future moving of types easier

@sffc sffc requested review from Manishearth, zbraniecki and a team as code owners October 14, 2024 18:28
@sffc sffc added the discuss-priority Discuss at the next ICU4X meeting label Oct 14, 2024
@sffc
Copy link
Member Author

sffc commented Oct 14, 2024

I thought we had consensus on this but @robertbastian made some good points that Formatter by itself is not consistent with the style guide, for good reason.

What should I name it?

I can introduce type aliases such as pub type DateFormatter = Formatter<YMD> but this won't cover all cases.

@robertbastian
Copy link
Member

pub type DateFormatter = GenericFormatter<YMD>

@robertbastian
Copy link
Member

ah that doesn't work because it's doubly generic, and we'll end up with TypedGenericFormatter.

It generic in a FieldSet, so FieldSetFormatter?

@Manishearth
Copy link
Member

FieldSetFormatter feels too inside baseball

Copy link
Member

@robertbastian robertbastian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

@sffc sffc added this to the ICU4X 2.0 Beta ⟨P1⟩ milestone Oct 15, 2024
@sffc
Copy link
Member Author

sffc commented Oct 15, 2024

I'd like this discussion resolved ASAP because I want it for the Alpha release and the UTW presentation.

Does anyone have other bikesheds they want to toss in the hat?

@Manishearth
Copy link
Member

I'm ultimately fine with Formatter. I think if Temporal were not taken by ECMA I would find TemporalFormatter interesting.

I don't think there's a good generic term for "formats a lot of things that do with time but not things that are unrelated to time" without calling it TimeFormatter, and that's wrong.

@robertbastian
Copy link
Member

FieldSetFormatter feels too inside baseball

is FieldSet not something we expose, and explain in docs?

@Manishearth
Copy link
Member

@robertbastian We do, but I don't want every user to have to think about it, plus it's not super discoverable. I'm fine with it as a component of our system, but not for discoverability. I find icu_datetime::Formatter to be more discoverable than icu_datetime::FieldSetFormatter.

I think people can learn about fieldsets after they discover and try to use this type, it feels weird for them to be expected to make that connection so that they discover this type and decide it is what they want. I'd probably gloss over a type named FieldSetFormatter because I'd go "I'm not formatting field sets, I don't even know what those are!", and go look for a formatter elsewhere.

@robertbastian
Copy link
Member

I think the main entry point should be type aliases. Users can learn about FieldSetFormatter after they learn about field sets.

@sffc
Copy link
Member Author

sffc commented Oct 15, 2024

If we wanted the entrypoint to be the type aliases, we would need a large number of type aliases, basically one per field set. YearMonthFormatter, YearMonthDayFormatter, HourFormatter, HourMinuteFormatter, etc. We could consider adding DateFormatter but users should prefer using the field-set-specific formatter.

Also, this gets us into naming problems again. I think it should be Hour_Minute_Formatter. We avoid this by making it icu::datetime::Formatter<HM>.

@Manishearth
Copy link
Member

If we wanted the entrypoint to be the type aliases, we would need a large number of type aliases

string agree! I'm not strongly opposed to doing all the aliases, but I do think it would be a pain, and I don't really want to commit to that right now.

I think we have a good reason to deviate from style here with Formatter, it formats a large set of things without formatting all things.

This said, it would be pretty cool if we could produce a souped-up utility type GenericFormatter that does fixeddecimal/currency/datetimezone/etc and uses a built up version of the GetField infra here.

@sffc
Copy link
Member Author

sffc commented Oct 18, 2024

Replaced by #5708

@sffc sffc closed this Oct 18, 2024
@sffc sffc deleted the NeoFormatter-->-Formatter branch October 18, 2024 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss-priority Discuss at the next ICU4X meeting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants