I wrote: > Damian explains: > > Trey asked: > > > > > To take the E6 example of currying &part: > > > > > > &List::Part::part.assuming(labels => <<sheep goats>>) > > > > > > One had to curry in C<labels> to be the same as it was defined in C<&part> > > > originally, i.e. C<< <<sheep goats>> >>. > > > > > > What if one wanted to curry in whatever the default is, i.e., assuming > > > "nothing" (different from "assuming nothing"), so that if List::Part::part > > > changed its default for C<labels> to C<< <<oves caperes>> >>, the client > > > code would pick that up? > > > > If you're assuming "nothing", don't use C<.assuming> (since you aren't ;-) > > Just write: > > > > sub my_part(Selector $s, [EMAIL PROTECTED]) { part $s <== *data } > > > > and let C<&part> do the assuming for you. > > Gee, that's about as helpful as saying to do &baz.assuming(foo => 'bar'): > > sub my_baz([EMAIL PROTECTED]) { > baz foo => 'bar' <== [EMAIL PROTECTED] > } > > Wasn't the whole idea of assuming to make it easy to curry without > knowing the entire signature, and being tolerant to changes? I see a > simple solution: > > our &my_part := &part.assuming('labels'); > > Or, maybe if we're caught up on readability (and error checking): > > our &my_part := &part.assuming(none 'labels');
Here's a wacky idea. We have C<undef> for for undefined, and C<defined> to check it. We have C<exists> to check existance, so, (hold your breath) C<nonex>. A synonym of: delete %h{foo}; would be %h{foo} = nonex; To assume that a value wasn't provided: our &my_part := &part.assuming(labels => nonex); And to declaratively copy a hash but delete a key: { %other, baz => nonex, } > Luke > > > Damian