Logical assignment for default assignments

A proposal for using the logical assignments ||= and ??= in default assignment in function arguments and destructuring.

I've made a repo here: https://github.com/jun-sheaf/proposal-logical-default-assignment.

Looking for feedback (and a champion :trophy:)

3 Likes

Bump (can we bump here :face_with_hand_over_mouth:)

Have you considered including 'logical and' &&= for completeness?

1 Like

What would be the use case?

I've far more often wanted ?? behavior than strictly "not undefined" on function arguments, and it's not possible to migrate to default parameters without causing breakage in many existing libraries.