Re: Default values for nulls

2020-10-13 Thread Jacob Bloom
I'd find it more readable to allow an assignment operator, with the semantic "do this transformation, using the passed value as the previous value" ``` function (x ??= 123) {} // If passed null or undefined, x = 123 function (x &&= 123) {} // If passed a truthy value, x = 123 function (x += 123)

Re: Default values for nulls

2020-10-13 Thread Naveen Chawla
What about allowing any expression then? x || 4 x/4 x + 4 x + w //maybe allow only "previous" parameter values as scope x + a //SyntaxError: 'a' undefined in parameters scope On Tue, 13 Oct 2020 at 14:39, Michael Luder-Rosefield < rosyatran...@gmail.com> wrote: > I know I am not the only one

Default values for nulls

2020-10-13 Thread Michael Luder-Rosefield
I know I am not the only one who has had several perfectly good use-cases for default values disallowed, because the value coming in was `null`, not `undefined`. I cannot be the only one who has let bugs slip in because of failing to consider this case. So, if we can find a non-confusing and