On Tue, Aug 27, 2024 at 6:23 AM John Coggeshall <j...@coggeshall.org> wrote:
> > But let's not just say "no expressions" - I think there's been some > demonstrated value from a lot of these. > > > Honest to god I don't think I've read from one person to come out and say > "no expressions". > Well... I think it's causing more confusion than insight when we talk about blanket "expressions" in the context of "default" here. Expressions in function calls were always permitted: foo(1+2); // Evaluating an expression and sending the result as the value of the first parameter The question is whether to allow OPERATIONS on "default". Notice the difference here: 1. foo($userValue ?? default); // No operations performed on default, very useful feature! This is still an expression involving the keyword default. 2. foo(default + 2); // "default" must evaluate to a value so we can perform operations on it. This is also an expression, but I would not be in favor of this behavior. So the real 3 options are: 1. No operations on "default". Treat "default" as a placeholder and send it as such to the function. Any expression that evaluates to "default" is fine. My opinion: Useful. 2. Allow any operations on "default". Extract the value and treat "default" as any other "variable". My opinion: Dirty, possibly useful to some, but I wouldn't use it, and would rather not find it in my code. 3. Allow SOME operations on "default", and block others. My opinion: Nightmare. Both discussing which operations and why, documenting it and maintaining it. I'm out :-) So let's STOP talking about yes or no to EXPRESSIONS and START talking about yes or no to OPERATIONS. Best, Jakob