https://codereview.appspot.com/42190043/diff/1/lily/unpure-pure-container.cc
File lily/unpure-pure-container.cc (right):

https://codereview.appspot.com/42190043/diff/1/lily/unpure-pure-container.cc#newcode45
lily/unpure-pure-container.cc:45:
Looking good.

The only thing is - how do we verify that this actually ignores start
and end?

For example, let's say that there is a scheme function with optional
arguments for start and end that is used as the pure and unpure
function.  It'll evaluate just fine for unpure cuz begin and end are
optional.  But begin and end may be useful when it is pure.  If this is
the only function passed to the constructor, it will return true for the
function above and yet perhaps be an operation that we don't want to
cache.

Conversely, it is possible to do:

(ly:make-unpure-pure-container foo foo)

that should be cached but it would return false for this function.

So, my proposal would be:

1) if there is a single function, verify that it takes only one argument
2) if there are two functions, verify that the second takes only one
argument

All of this is of course predicated, like I said above, on being able to
check the number of arguments a scheme function takes, which may or may
not be possible...

Or create a new type predicate for a new class of functions instead of
doing a boolean test (which seems like a pain...so I like the boolean
approach above).

https://codereview.appspot.com/42190043/

_______________________________________________
lilypond-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to