lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Make music functions callable from Scheme (issue 244840043 by addres


From: dak
Subject: Re: Make music functions callable from Scheme (issue 244840043 by address@hidden)
Date: Tue, 09 Jun 2015 01:04:44 +0000

On 2015/06/08 16:38:28, dak wrote:
On 2015/06/08 15:58:31, Keith wrote:

> Or maybe advance through 'signature' to the next non-optional
argument
> immediately upon using a default value, rather than setting
'skipping'.

I thought about that, yes.  It would give us one outer loop that goes
through
actual argument list and signature in lockstep, and one inner loop
that goes
through signature only.  I think that I tried this already and that it
did not
really work out well.  I'll give it another attempt but I doubt I'll
come up
with something better.

No dice.  The main problem is dealing with all combinations of running
out of signature and running out of available arguments.  If you treat
the optional argument skipping in an inner loop, you may still run out
of signature, and in that case you still need to treat the case where
you have simultaneously run out of arguments (namely because the
non-matching argument triggering the skipping was \default aka
*unspecified) separately _and_ break out of all loops.  Since you have
already fetched the next signature bit (since you would not know whether
it was optional and skipping should continue), you can't return to the
main loop which would fetch it again but need to clad the whole in one
while (scm_is_false (scm_call_1 (pred, arg))) of its own.  Treating all
the terminating condition combinations in inner loop and outer loop
separately causes the control structures to fray apart more than the
"skipping" flag does, to the degree where the cleanest solution to
handle one of the innermost loop termination conditions with a goto
statement.

I've spent another whole work day on this.  Feel free to invest time of
your own on a followup issue/patch better matching your code aesthetics.
 The regtest, while not complete coverage, does a good job of exercising
most of the code paths in question.

https://codereview.appspot.com/244840043/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]