-
Notifications
You must be signed in to change notification settings - Fork 158
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
Receiver should be validated/processed before arguments #2462
Comments
It could be debatable which order of operations best expresses the design principle, but ultimately I agree with the one you suggested above. |
I audited all of the methods with at least one argument. Aside from I also found that in PlainYearMonth's |
Changes to the order of observable operations in - PlainDate.p.with - PlainDateTime.p.with - PlainMonthDay.p.with - PlainTime.p.with - PlainYearMonth.p.since - PlainYearMonth.p.until - PlainYearMonth.p.with - ZonedDateTime.p.with Swapping the PrepareTemporalFields calls in ZonedDateTime.p.with exposed another unnecessary user call: the 'timeZone' field was observably read from the receiver and from the object returned from mergeFields(), but never used. This is fixed as well. Closes: #2462
Changes to the order of observable operations in - PlainDate.p.with - PlainDateTime.p.with - PlainMonthDay.p.with - PlainTime.p.with - PlainYearMonth.p.since - PlainYearMonth.p.until - PlainYearMonth.p.with - ZonedDateTime.p.with Swapping the PrepareTemporalFields calls in ZonedDateTime.p.with exposed another unnecessary user call: the 'timeZone' field was observably read from the receiver and from the object returned from mergeFields(), but never used. This is fixed as well. Closes: #2462
Changes to the order of observable operations in - PlainDate.p.with - PlainDateTime.p.with - PlainMonthDay.p.with - PlainTime.p.with - PlainYearMonth.p.since - PlainYearMonth.p.until - PlainYearMonth.p.with - ZonedDateTime.p.with Swapping the PrepareTemporalFields calls in ZonedDateTime.p.with exposed another unnecessary user call: the 'timeZone' field was observably read from the receiver and from the object returned from mergeFields(), but never used. This is fixed as well. Closes: #2462
Changes to the order of observable operations in - PlainDate.p.with - PlainDateTime.p.with - PlainMonthDay.p.with - PlainTime.p.with - PlainYearMonth.p.since - PlainYearMonth.p.until - PlainYearMonth.p.with - ZonedDateTime.p.with Swapping the PrepareTemporalFields calls in ZonedDateTime.p.with exposed another unnecessary user call: the 'timeZone' field was observably read from the receiver and from the object returned from mergeFields(), but never used. This is fixed as well. Closes: #2462
Changes to the order of observable operations in - PlainDate.p.with - PlainDateTime.p.with - PlainMonthDay.p.with - PlainTime.p.with - PlainYearMonth.p.since - PlainYearMonth.p.until - PlainYearMonth.p.with - ZonedDateTime.p.with Swapping the PrepareTemporalFields calls in ZonedDateTime.p.with exposed another unnecessary user call: the 'timeZone' field was observably read from the receiver and from the object returned from mergeFields(), but never used. This is fixed as well. Closes: tc39#2462
Changes to the order of observable operations in - PlainDate.p.with - PlainDateTime.p.with - PlainMonthDay.p.with - PlainTime.p.with - PlainYearMonth.p.since - PlainYearMonth.p.until - PlainYearMonth.p.with - ZonedDateTime.p.with Swapping the PrepareTemporalFields calls in ZonedDateTime.p.with exposed another unnecessary user call: the 'timeZone' field was observably read from the receiver and from the object returned from mergeFields(), but never used. This is fixed as well. Closes: #2462 UPSTREAM_COMMIT=c9939fd078676c3fda40d06f3b8b5067c35dc124
Related to but distinct from #2289, observable interactions with arguments should take place in order (cf. #2377 (comment) ) after validation and processing of the receiver. This is violated by at least the
with
methods, which invoke PrepareTemporalFields on the first argument before the receiver (observable in code that e.g. defines getters on the receiver like(i => Object.defineProperties(Temporal.PlainYearMonth.from("2022-12"), { year: { get:()=>i++ } }).with({ get month(){ return i++; } }))(1)
, which currently returns 0002-01 rather than 0001-02).For
with
methods in particular, I believe the general corrected steps would beThe text was updated successfully, but these errors were encountered: