[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: parser-ly-from-scheme: Make #{ compilable (issue 581610043 by addres
From: |
dak |
Subject: |
Re: parser-ly-from-scheme: Make #{ compilable (issue 581610043 by address@hidden) |
Date: |
Sat, 08 Feb 2020 14:02:59 -0800 |
Reviewers: thomasmorley651,
https://codereview.appspot.com/581610043/diff/569310043/scm/parser-ly-from-scheme.scm
File scm/parser-ly-from-scheme.scm (right):
https://codereview.appspot.com/581610043/diff/569310043/scm/parser-ly-from-scheme.scm#newcode19
scm/parser-ly-from-scheme.scm:19: (define (read-lily-expression-internal
lily-string filename line closures)
On 2020/02/08 20:35:49, thomasmorley651 wrote:
> I was going to write that we would need to care about displayLilyMusic
as well,
> though checking again I noticed:
>
> \void \displayLilyMusic
> \new Voice { \applyContext #(lambda (ctx) (display ctx)) b4 }
>
> with an older lily-build against guile-2.0.14 returns:
>
> \new Voice { \applyContext ##f
> b4 }
>
> A todays build with guile-2.2.6 returned:
>
> \new Voice { \applyContext #(lambda (ctx) (display ctx))
> b4 }
>
> Which is nice.
>
> Not sure whether it's a lilypond or guile improvement.
Uh, is this the right issue to discuss this with? Also
dak@lola:/usr/local/tmp/lilypond$ dpkg -l guile-2.2-dev
Desired=Unknown/Install/Remove/Purge/Hold
|
Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-=================================
ii guile-2.2-dev 2.2.6+1-1 amd64 Development files for Guile
2.2
Are you completely sure that you are using a version of LilyPond
compiled with Guile-2.2.6? Because I did not do that fix in issue 5743
on a whim but because code very similar to the above bombed out in
display-lily-tests.ly. Maybe the test code in there behaves differently
for some reason?
Description:
parser-ly-from-scheme: Make #{ compilable
For better or worse, Guile 2 has problems byte-compiling function
values. Factor out the previous internal function
read-lily-expression-internal and refer to it by (module-relative)
name rather than value in Guile 2.
Please review this at https://codereview.appspot.com/581610043/
Affected files (+11, -11 lines):
M scm/parser-ly-from-scheme.scm
Index: scm/parser-ly-from-scheme.scm
diff --git a/scm/parser-ly-from-scheme.scm b/scm/parser-ly-from-scheme.scm
index
2c75010ab809df3e24b3736a6021dad8c6604e59..1bd8ac70da2a6cc2e38f0f513f9ff317af8bab47
100644
--- a/scm/parser-ly-from-scheme.scm
+++ b/scm/parser-ly-from-scheme.scm
@@ -16,6 +16,13 @@
;;;; You should have received a copy of the GNU General Public License
;;;; along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
+(define (read-lily-expression-internal lily-string filename line closures)
+ (let* ((clone (ly:parser-clone closures (*location*)))
+ (result (ly:parse-string-expression clone lily-string filename line)))
+ (if (ly:parser-has-error? clone)
+ (ly:parser-error (_ "error in #{ ... #}") (*location*)))
+ result))
+
(define-public (read-lily-expression chr port)
"Read a lilypond music expression enclosed within @code{#@{} and @code{#@}}
from @var{port} and return the corresponding Scheme music expression.
@@ -97,16 +104,9 @@ from @var{port} and return the corresponding Scheme music
expression.
(else
(do ((c (copy-char) (copy-char)))
((char=? c #\nl)))))))))))))
-
- (define (embedded-lilypond lily-string filename line closures)
- (let* ((clone (ly:parser-clone closures (*location*)))
- (result (ly:parse-string-expression clone lily-string
- filename line)))
- (if (ly:parser-has-error? clone)
- (ly:parser-error (_ "error in #{ ... #}") (*location*)))
- result))
- (list embedded-lilypond
- lily-string filename line
- (cons 'list (reverse! closures)))))
+ (list (if (guile-v2)
+ '(@@ (lily) read-lily-expression-internal)
+ read-lily-expression-internal)
+ lily-string filename line (cons 'list (reverse! closures)))))
(read-hash-extend #\{ read-lily-expression)