lilypond-devel
[Top][All Lists]
Advanced

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

Creates pure closures (issue 4894052)


From: mtsolo
Subject: Creates pure closures (issue 4894052)
Date: Thu, 18 Aug 2011 09:21:59 +0000

Reviewers: ,

Message:
This is a more extensible way to deal with pure properties.  I'd like
this patch to be the first step, with the second step being rewriting
define-grob-properties.scm such that it uses pure closures as much as
possible.  First, create a procedure:

#(define-public (pure-wrapper proc)
  (lambda (grob start end) (proc grob)))

Then, for example:

(stencil . ,ly:clef::print)

becomes

(stencil . ,(ly:pure-closure ly:clef::print (pure-wrapper
ly:clef::print)))

...

(Y-extent . ,ly:stem::height)

becomes

(Y-extent . ,(ly:pure-closure ly:stem::height ly:stem::pure-height))

etc.

It'd allow the elimination of the lists down in the bottom of
define-grobs.scm and would allow call-pure-function to be a lot smaller.

The reason I'm doing this is in anticipation of my work with stems.
Given that the user will be overriding properties that have pure
conversions, it seems logical that the user would be able to define pure
conversions for said overrides.

Cheers,
MS

Description:
Creates pure closures

Please review this at http://codereview.appspot.com/4894052/

Affected files:
  A input/regression/pure-closure.ly
  M lily/context-property.cc
  M lily/grob-property.cc
  A lily/include/pure-closure.hh
  A lily/pure-closure.cc
  M scm/define-grobs.scm





reply via email to

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