lilypond-devel
[Top][All Lists]
Advanced

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

Re: Anybody invested in ly:make-simple-closure?


From: David Kastrup
Subject: Re: Anybody invested in ly:make-simple-closure?
Date: Thu, 24 Sep 2015 12:08:38 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Han-Wen Nienhuys <address@hidden> writes:

> IIRC, it was introduced to compose offset callbacks, but a quick check
> doesn't reveal any historical uses. It doesn't strike me especially
> inscrutable, but if you can make it go away, it's probably for the
> best.

Well, it's like some sort of lambda for grob property calls.  Except
that it does not look up symbols itself.  And when you use something in
the place of a function call, then it is called with a varying number of
arguments depending on whether we are in a pure call or not.

However, if Simple_closure in a Simple_closure is used outside of a
function call location, its inside expression has to have the form of a
function call (or some unpure-pure container) and then the container or
its respective function component is called with the grob argument as
well as potential start and end arguments.

But if Simple_closure in a Simple_closure is used in the location of a
function call.  No wait, that is not an option.  But an
Unpure_pure_container may be used in the position of a function call,
and then it will be called according to its normal calling convention.
Except that it (or any other function) will not be given an actual
"grob" argument but still get, for the pure call, the start and end
arguments (though after the first non-grob argument).  WTF?  But that's
only when in the position of a function call.  As a direct non-list
argument to Simple_closure, a function inside of an
Unpure_pure_container _will_ get the grob argument.

I get a headache just reading the code.  There are probably a few bugs
in there and I very much suspect that Mike bungled the integration of
unpure-pure-containers somewhat but since nobody ever used those
combinations, nobody noticed or bothered.

Since the documentation of ly:make-simple-closure is so lousy, the main
source of information is its code.  Which I very much suspect to be
buggy.  But before secondguessing this contraption and trying to fix
what I guess may be bugs, I think I am better off throwing it out given
its current rather minimal use.

It's too smart for its documentation and implementation.

It's too smart for me.  I _think_ one could have used it for
implementing unpure-pure-containers before they were invented by Mike
(I think).  That Mike didn't do so probably meant that they were too
smart for Mike as well even before they needed to get integrated with
unpure-pure-containers.

Too smart for me and too smart for Mike and too smart for all the smart
contributors to the LSR is not just a red flag but a whole military
parade.

With some Scheme macro programming, one could probably have turned this
into a somewhat user-accessible tool.  That ship has sailed and I prefer
demolishing the harbor and building one in a better accessible place
before I will think about its return.

-- 
David Kastrup



reply via email to

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