[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
anonymous functions in define-grobs.scm
From: |
Keith OHara |
Subject: |
anonymous functions in define-grobs.scm |
Date: |
Fri, 22 Nov 2013 21:31:47 -0800 |
User-agent: |
Opera Mail/12.16 (Win32) |
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.
- anonymous functions in define-grobs.scm,
Keith OHara <=