[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Creates pure closures (issue 4894052)
From: |
n . puttock |
Subject: |
Re: Creates pure closures (issue 4894052) |
Date: |
Thu, 18 Aug 2011 12:31:29 +0000 |
Hi Mike,
I have reservations about the naming, since you're basically creating a
smob which acts as a container for a pair of callbacks; it doesn't work
like a simple-closure in that you can evaluate the closure and get
something useful back.
Cheers,
Neil
http://codereview.appspot.com/4894052/diff/1/lily/pure-closure.cc
File lily/pure-closure.cc (right):
http://codereview.appspot.com/4894052/diff/1/lily/pure-closure.cc#newcode65
lily/pure-closure.cc:65: 2, 0, 0, (SCM pc),
1, 0, 0,
(there's only one arg; looks like you've been cut'n'pasting from
simple-closure.cc :)
http://codereview.appspot.com/4894052/diff/1/lily/pure-closure.cc#newcode73
lily/pure-closure.cc:73: 2, 0, 0, (SCM pc),
1, 0, 0,
http://codereview.appspot.com/4894052/diff/1/lily/pure-closure.cc#newcode84
lily/pure-closure.cc:84: scm_display (scm_cdr (s), port);
this only displays the unpure part, and if you change it to show both,
there seems to be a garbage collection problem (probably to do with
using scm_markcdr in init_pure_closure ()); the pure part has been swept
away:
\relative c' {
\override Stem #'Y-extent =
#(ly:make-pure-closure ly:stem::height '(-3 . 10))
c4
}
\layout {
\context {
\Voice
\override Stem #'after-line-breaking =
#(lambda (grob)
(let ((data (ly:grob-property-data grob 'Y-extent)))
(and (ly:pure-closure? data)
(newline)
(display data))))
}
}
-> #<pure-closure #<primitive-procedure ly:stem::height> #<freed cell
0x7f4148a3f960; GC missed a reference> >
(the wrapper you posted fails even for a \once \override, and would be
bad for documentation purposes since the pure part would show as an
anonymous lambda)
http://codereview.appspot.com/4894052/
- Creates pure closures (issue 4894052), mtsolo, 2011/08/18
- Re: Creates pure closures (issue 4894052), n . puttock, 2011/08/19
- Re: Creates pure closures (issue 4894052), pkx166h, 2011/08/27
- Re: Creates pure closures (issue 4894052), n . puttock, 2011/08/31
- Re: Creates pure closures (issue 4894052), n . puttock, 2011/08/31