Closed anba closed 1 year ago
Yikes, that's an easy trap to fall into, for sure.
This is indeed an intentional design choice, but as I mentioned in the other issue: if this is causing problems in the implementation, especially with respect to optimizability, I think we should put it on the agenda to discuss in a Temporal champions meeting.
Seems like a good thing to fix. Obvious bug that's easy to encounter.
We had a bit of discussion on this in the Temporal champions meeting of 2022-10-13 and have a temperature check for some possible solutions:
We'll discuss this again in the future.
I continue to feel pretty strongly that required args should be positional whenever possible, which seems to conflict with option 3.
Champions meeting 2022-10-27: We'll go with #4 above:
Throw when passing an object with [[InitializedTemporalCalendar]] to ToTemporalTimeZone and vice versa, accepting the potential for bugs when using (very rare, specialized) plain-object protocol implementations — some strong preference for this, others think it's a hack without precedent in the language
Probably just a FYI, because the underlying issue was already reported in #1652, which in turn links to #300 and #1294.
I was recently writing this incorrect code:
timeZone
andcalendar
were passed in the wrong order, which leads to an error only after some methods onzdt.[[TimeZone]]
orzdt.[[Calendar]]
are called:Directly catching this mistake when creating the
ZonedDateTime
would be nicer, but I'm not sure how to best detect this case, given that accepting any object for the time zone and calendar arguments was an intentional design choice.