-
Notifications
You must be signed in to change notification settings - Fork 255
Change AstronomicalSimulation
#7342
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
base: main
Are you sure you want to change the base?
Conversation
99cd652 to
5ea69c0
Compare
sffc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this direction is consistent with #7340, since it takes advantage of the bullet point "We decide to tweak the precise astronomical simulation used" and keeps the type AstronomicalSimulation as representing an astronomical simulation, just a different one than we had been shipping before.
| Ok(AnyCalendarKind::HijriTabularTypeIIFriday) | ||
| } | ||
| Hijri(Some(HijriCalendarAlgorithm::Rgsa)) => Ok(AnyCalendarKind::HijriSimulatedMecca), | ||
| Hijri(Some(HijriCalendarAlgorithm::Rgsa)) => Err(()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't return Err elsewhere in this fn; what is the impact?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes we do, for -u-ca-islamic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for removing this mapping.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this creates a new code path. -u-ca-islamic doesn't make it into this impl; it is remapped in resolved_algorithm() above. This new case means that -u-ca-islamic-rgsa maps unconditionally to Gregorian due to the unwrap_or(Self::Gregorian) in AnyCalendarKind::new. It should instead map to the locale default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it go to the locale default, or should it behave like -u-ca-islamic which goes to the locale default Hijri?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've now specifically documented, on resolved_algorithm,
/// This is guaranteed to return a [`CalendarAlgorithm`] that successfully converts into an
/// [`AnyCalendarKind`] (i.e. not `-u-ca-islamic` or `-u-ca-islamic-rgsa`).
I feel like islamic-rgsa should have the same behavior as islamic-zzz.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
1083fa9 to
5652bd5
Compare
Co-authored-by: Manish Goregaokar <[email protected]>
Manishearth
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In favor of the technical implementation here.
Exact future for calendars still seems to be in flux, I am personally in favor of this being a component of most paths forward (potentially paired with some deprecation), but see #7320
hsivonen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. Removing the rgsa mapping and putting the Reingold simulation behind a flag resolve my main concerns, though I still think we shouldn't have this level of attachment to keeping the Reingold simulation.
Since AstronomicalSimulation exist for semver and duplicates to a Umm al-Qura, it seems to me AstronomicalSimulation should be marked deprecated.
| /// - We decide to expand or reduce the range where we are using the astronomical simulation. | ||
| #[derive(Copy, Clone, Debug, PartialEq, Eq)] | ||
| #[non_exhaustive] | ||
| pub struct AstronomicalSimulation; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why isn't this deprecated if this duplicates Umm al-Qura behavior and exists for semver?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to do this in as small chunks as possible to make some progress
| Ok(AnyCalendarKind::HijriTabularTypeIIFriday) | ||
| } | ||
| Hijri(Some(HijriCalendarAlgorithm::Rgsa)) => Ok(AnyCalendarKind::HijriSimulatedMecca), | ||
| Hijri(Some(HijriCalendarAlgorithm::Rgsa)) => Err(()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for removing this mapping.
sffc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a technical and docs review.
| Ok(AnyCalendarKind::HijriTabularTypeIIFriday) | ||
| } | ||
| Hijri(Some(HijriCalendarAlgorithm::Rgsa)) => Ok(AnyCalendarKind::HijriSimulatedMecca), | ||
| Hijri(Some(HijriCalendarAlgorithm::Rgsa)) => Err(()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this creates a new code path. -u-ca-islamic doesn't make it into this impl; it is remapped in resolved_algorithm() above. This new case means that -u-ca-islamic-rgsa maps unconditionally to Gregorian due to the unwrap_or(Self::Gregorian) in AnyCalendarKind::new. It should instead map to the locale default.
hsivonen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant to choose the Approve option earlier.
|
Consensus: As agreed in #7422, this can be handled by migration notes; we don't need to retain the ReingoldSimulation type. |
AstronomicalSimulation -> ReingoldSimulationAstronomicalSimulation
| Ok(AnyCalendarKind::HijriTabularTypeIIFriday) | ||
| } | ||
| Hijri(Some(HijriCalendarAlgorithm::Rgsa)) => Ok(AnyCalendarKind::HijriSimulatedMecca), | ||
| Hijri(Some(HijriCalendarAlgorithm::Rgsa)) => Err(()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've now specifically documented, on resolved_algorithm,
/// This is guaranteed to return a [`CalendarAlgorithm`] that successfully converts into an
/// [`AnyCalendarKind`] (i.e. not `-u-ca-islamic` or `-u-ca-islamic-rgsa`).
I feel like islamic-rgsa should have the same behavior as islamic-zzz.
| /// | ||
| /// [^1]: See [calendrical_calculations::islamic::observational_islamic_from_fixed] | ||
| #[derive(Debug, Clone, Copy)] | ||
| pub struct ReingoldSimulation; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Praise: good to retain this code even if outside of src. Is tests the right place, or should it be in examples?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to advertise this
| /// The kind of a [`HijriSimulated`] calendar | ||
| /// | ||
| /// This corresponds to the `"islamic-rgsa"` [CLDR calendar](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier). | ||
| /// This does not correspond to a CLDR calendar. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue: Well, actually it does correspond to a CLDR calendar, just not one that ICU4X chooses to implement. The previous language is still correct.
| /// assert_eq!(CalendarPreferences::from(&locale!("und-AF")).resolved_algorithm(), CalendarAlgorithm::Persian); | ||
| /// assert_eq!(CalendarPreferences::from(&locale!("und-US-u-rg-thxxxx")).resolved_algorithm(), CalendarAlgorithm::Buddhist); | ||
| /// assert_eq!( | ||
| /// CalendarPreferences::from(&locale!("und-US-u-ca-islamic")).resolved_algorithm(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: We should have a test for what happens with islamic-zzz, islamic-rgsa, and buddhist-zzz.
No description provided.