On Sun Jan 27 19:32:30 2019, TOBYINK wrote:
Show quoted text> On 2019-01-27T17:38:09Z, srchulo wrote:
> > That's what Params::ValidationCompiler does, and I think that makes
> > the most sense. I believe this would also line up with the behavior
> > in
> > the object returned from compile_named_oo.
>
> compile_named_oo will return undef if you call a method corresponding
> to a missing named parameter, but it does also have `has_foo` methods.
>
> With named_to_list, there's effectively no way to distinguish between
> a value of undef and a missing value. But in many cases, you don't
> care about that distinction anyway, so I don't think that's a problem
> provided it's documented.
Yeah, I agree-- as long as it's documented, I think it's fine. And if someone cares, they can use the oo method.
Also, I believe this matches up with the normal compile() with positional parameters?
# Positional parameters
state $check = compile(Int, Optional[Int], Optional[Int]);
my ($foo, $bar, $baz) = $check->(@_); # $bar and $baz are optional