Ryan Richter wrote:
> Jonathan Lang wrote:
> > and so on, you might do something like:
> >
> >   with &qq :(c => false) {
>
> I think this can be done with normal currying, something like
>
> temp &circumfix:<" "> := &quote:<qq>.assuming(:!c);

That handles the specific example that I had in mind, but does so in a
rather brittle way.  First, the programmer is forced to use
double-quotes to make use of the currying; he cannot switch to another
quoting character if one of the strings that he's dealing with has a
number of double-quote characters in it.  This being a
quoting-specific issue, it should be no surprise that it comes with a
quoting-specific solution, e.g., use 'qs' instead of 'qq:!c') - but
that still leaves you with having to prefix every string in the target
scope: c<qs" ... "> instead of c<" ... ">.  Still, that isn't my main
concern here.

There's no way that I know of to override the currying: every
.assuming that you use removes one parameter from the signature (if I
understand currying correctly).  This means that you don't get to set
assumed values for three different parameters at the start of the
block and then override just one of them for a single use of the
function in the middle of the block.  This concern could probably be
addressed if currying doesn't remove arguments from a signature, but
instead forces them to be optional and assigns default values to them;
but this can lead to its own problems, such as what happens when you
curry the second of three required positional parameters.

What I was thinking of would be somewhat more modest: it would be a
variation on the currying mechanic, but would only apply to optional
parameters.  It wouldn't remove them from the signature at all; it
would merely change the default values assigned to them.

-- 
Jonathan "Dataweaver" Lang

Reply via email to