Near the top of 'define-grobs.scm' it says
;;;; WARNING: don't use anonymous functions for initialization.
and I am wondering why.

I suspected it was to avoid storing a function body in every instance of the 
type of grob that might have an anonymous function as one of its default 
properties.
But then I see that we use
 (X-offset .
  ,(ly:make-simple-closure
    `(,+
      ,(ly:make-simple-closure
       (list ly:break-alignable-interface::self-align-callback))
      ,(ly:make-simple-closure
       (list ly:self-alignment-interface::x-aligned-on-self)))))

rather than the simpler
 (X-offset .
  ,(lambda (g)
     (+ (ly:break-alignable-interface::self-align-callback g)
        (ly:self-alignment-interface::x-aligned-on-self g))))

which follows the rule in the WARNING, but does not seem that it would reduce 
the storage needed in each grob.

The warning appeared in a commit from 2002 that mentions Guile 1.4 
compatibility, so I suspect it might be something more serious.


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

Reply via email to