Skip to content

Conversation

@robertbastian
Copy link
Member

No description provided.

@robertbastian robertbastian force-pushed the simulated branch 2 times, most recently from 99cd652 to 5ea69c0 Compare December 23, 2025 17:13
Copy link
Member

@sffc sffc left a 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(()),
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member Author

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?

Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

Copy link
Member

@Manishearth Manishearth left a 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

Copy link
Member

@hsivonen hsivonen left a 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;
Copy link
Member

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?

Copy link
Member Author

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(()),
Copy link
Member

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.

Copy link
Member

@sffc sffc left a 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(()),
Copy link
Member

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.

Copy link
Member

@hsivonen hsivonen left a 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.

@sffc
Copy link
Member

sffc commented Jan 15, 2026

Consensus: As agreed in #7422, this can be handled by migration notes; we don't need to retain the ReingoldSimulation type.

@robertbastian robertbastian changed the title AstronomicalSimulation -> ReingoldSimulation Change AstronomicalSimulation Jan 16, 2026
Ok(AnyCalendarKind::HijriTabularTypeIIFriday)
}
Hijri(Some(HijriCalendarAlgorithm::Rgsa)) => Ok(AnyCalendarKind::HijriSimulatedMecca),
Hijri(Some(HijriCalendarAlgorithm::Rgsa)) => Err(()),
Copy link
Member

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;
Copy link
Member

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?

Copy link
Member Author

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

@robertbastian robertbastian requested a review from sffc January 16, 2026 21:48
/// 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.
Copy link
Member

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(),
Copy link
Member

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.

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

Successfully merging this pull request may close these issues.

4 participants