What is the point of \on-the-fly ?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

What is the point of \on-the-fly ?

David Kastrup

\on-the-fly gets as first argument a function that it calls on the
second argument as if the first argument was actually a markup command.

Why not make the first argument actually a markup command?

It would appear that we are mostly talking about a closed set here
anyway.  So why

\markup \on-the-fly #(on-page 3) "blabla"

instead of

\markup \on-page #3 "blabla"

?  Where is the point in this particular obfuscation?

--
David Kastrup

_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: What is the point of \on-the-fly ?

Thomas Morley-2
2017-06-11 15:08 GMT+02:00 David Kastrup <[hidden email]>:

>
> \on-the-fly gets as first argument a function that it calls on the
> second argument as if the first argument was actually a markup command.
>
> Why not make the first argument actually a markup command?
>
> It would appear that we are mostly talking about a closed set here
> anyway.  So why
>
> \markup \on-the-fly #(on-page 3) "blabla"
>
> instead of
>
> \markup \on-page #3 "blabla"
>
> ?  Where is the point in this particular obfuscation?
>
> --
> David Kastrup

on-the-fly is one (of two) markup-(list-)commands in
define-markup-commands.scm which takes a procedure as argument (the
other is map-markup-commands). This procedure needs to have three
arguments: layout, props and the one which is actually worked on.

I desperately tried to find such a procedure, being sufficiently
different from markup-(list-)-commands. To no avail.

So I'd vote for dropping on-the-fly entirely. (Unless somebody know a
good use-case)
Ofcourse several procedures in titling-init.ly would need to become
markup-commands.
map-markup-commands from define-markup-commands.scm needs to be changed as well.
And regtests and docs...


Cheers,
  Harm

_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: What is the point of \on-the-fly ?

David Kastrup
Thomas Morley <[hidden email]> writes:

> 2017-06-11 15:08 GMT+02:00 David Kastrup <[hidden email]>:
>>
>> \on-the-fly gets as first argument a function that it calls on the
>> second argument as if the first argument was actually a markup command.
>>
>> Why not make the first argument actually a markup command?
>>
>> It would appear that we are mostly talking about a closed set here
>> anyway.  So why
>>
>> \markup \on-the-fly #(on-page 3) "blabla"
>>
>> instead of
>>
>> \markup \on-page #3 "blabla"
>>
>> ?  Where is the point in this particular obfuscation?
>>
>> --
>> David Kastrup
>
> on-the-fly is one (of two) markup-(list-)commands in
> define-markup-commands.scm which takes a procedure as argument (the
> other is map-markup-commands). This procedure needs to have three
> arguments: layout, props and the one which is actually worked on.
>
> I desperately tried to find such a procedure, being sufficiently
> different from markup-(list-)-commands. To no avail.
>
> So I'd vote for dropping on-the-fly entirely. (Unless somebody know a
> good use-case)

The use case is similar to that of lambda: creating a procedure on the
fly without giving it a name.  But most of the current uses of
\on-the-fly are on a procedure _with_ a name.

> Ofcourse several procedures in titling-init.ly would need to become
> markup-commands.

My guess is that this might have been an emergency measure because of
problems with the scopes/modules of markups (since the usual \on-the-fly
suspects are in the \paper module).  But I think that this may have been
solved in the mean time.

> map-markup-commands from define-markup-commands.scm needs to be
> changed as well.  And regtests and docs...

I don't think there's anything wrong with keeping \on-the-fly .  But
requiring its use does not seem like doing people a favor.

--
David Kastrup

_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: What is the point of \on-the-fly ?

Paul Morris
On 06/12/2017 01:00 AM, David Kastrup wrote:

> The use case is similar to that of lambda: creating a procedure on the
> fly without giving it a name.

Ah, got it.  Then makes sense to avoid having to use on-the-fly, by
converting those named on-the-fly procedures into actual markup commands.

Just thinking out loud, but if define-markup-command worked like
define-music-function and friends (i.e. like lambda) so that they
returned a procedure, like this:

   command-name = #(define-markup-command (layout props args...) ...

   (define command-name (define-markup-command (layout props args...) ...

Rather than the current form:

   (define-markup-command (command-name layout props args...) ...

Would that remove the need for on-the-fly or am I missing something?  
I'm sure that would not be a trivial change -- again just thinking out loud.

-Paul

_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: What is the point of \on-the-fly ?

David Kastrup
Paul <[hidden email]> writes:

> On 06/12/2017 01:00 AM, David Kastrup wrote:
>
>> The use case is similar to that of lambda: creating a procedure on the
>> fly without giving it a name.
>
> Ah, got it.  Then makes sense to avoid having to use on-the-fly, by
> converting those named on-the-fly procedures into actual markup
> commands.
>
> Just thinking out loud, but if define-markup-command worked like
> define-music-function and friends (i.e. like lambda) so that they
> returned a procedure, like this:
>
>   command-name = #(define-markup-command (layout props args...) ...
>
>   (define command-name (define-markup-command (layout props args...) ...
>
> Rather than the current form:
>
>   (define-markup-command (command-name layout props args...) ...
>
> Would that remove the need for on-the-fly or am I missing something?
> I'm sure that would not be a trivial change -- again just thinking out
> loud.

(define-markup-command bla)

does not define bla, but rather bla-markup, make-bla-markup and bits and
pieces used for signatures and the markup macro.

Even then, creating music functions on the fly _and_ using them requires
use of $(define-music-function ...) since #(define-music-function ...)
does not call the generated music function (would be hard assigning a
music function if it got called right away...).

I actually just proposed an issue where you _can_ call markup functions
on the fly when defined properly.  But the process of assigning a markup
command with all that it entails cannot be done in the same manner.

Since we can generate markup commands "on the fly" with \markup
... \etc, assigning them in a manner corresponding to
define-markup-command might be nice.

I suggested

\markup bla = ...

for it without being all too clear about whether this implied \markup
mode, allowing for

\markup bla = \bold \large \etc

rather than

\markup bla = \markup \bold \large \etc

There were no real comments (and I am fuzzy on the details of the
ensuing non-discussion as far as I remember it) so this proposal petered
out.

--
David Kastrup

_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: What is the point of \on-the-fly ?

Paul Morris
On 06/13/2017 11:16 AM, David Kastrup wrote:

> (define-markup-command bla)
>
> does not define bla, but rather bla-markup, make-bla-markup and bits and
> pieces used for signatures and the markup macro.
>
> Even then, creating music functions on the fly _and_ using them requires
> use of $(define-music-function ...) since #(define-music-function ...)
> does not call the generated music function (would be hard assigning a
> music function if it got called right away...).

Ah ok, thanks for the explanation.  (I need to brush up on my $ vs #.)

> I actually just proposed an issue where you _can_ call markup functions
> on the fly when defined properly.

Sounds good.  This is the $ one.

> But the process of assigning a markup
> command with all that it entails cannot be done in the same manner.
>
> Since we can generate markup commands "on the fly" with \markup
> ... \etc, assigning them in a manner corresponding to
> define-markup-command might be nice.
>
> I suggested
>
> \markup bla = ...
>
> for it without being all too clear about whether this implied \markup
> mode, allowing for
>
> \markup bla = \bold \large \etc
>
> rather than
>
> \markup bla = \markup \bold \large \etc
>
> There were no real comments (and I am fuzzy on the details of the
> ensuing non-discussion as far as I remember it) so this proposal petered
> out.

Hmm, I must have missed this, but sounds promising.

-Paul

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