On Sun, Nov 29, 2015 at 2:26 AM, Nick Wellnhofer <[email protected]> wrote:
> There is no perfect way to handle the "bool defaults to true" case. If we > treat undef as false and the user wants "undef means default", code must > look like: > > $foo->bar(defined($bool) ? $bool : 1); # or > $foo->bar($bool // 1); > > If we treat undef as default and the user wants "undef means false", code > must look like: > > $foo->bar(defined($bool) ? $bool : 0); # or > $foo->bar($bool // 0); > > For Perl, I find "undef means false" more idiomatic. I see that you're using single-positional-argument functions for your example code. That would never have occurred to me, because I care more about the behavior of named parameters. I agree that treating single-positional-argument undef as false is reasonable. How about changing the behavior of autogenerated bindings for single-positional-argument functions while keeping the current behavior for named parameters? Would that be satisfactory? Marvin Humphrey
