Menu

#1349 Guile 2.0 compat: Scheme macros must be defined/autocompiled before they are used.

Verified
nobody
None
Enhancement
2016-03-21
2010-10-20
Anonymous
No

Originally created by: *anonymous

Originally created by: ianhuli...@gmail.com
Originally owned by: ianhuli...@gmail.com

From Guile NEWS
** Macros need to be defined before their first use.
   It used to be that with lazy memoization, this might work:
     (define (foo x)
       (ref x))
     (define-macro (ref x) x)
     (foo 1) => 1
   But now, the body of `foo' is interpreted to mean a call to the toplevel
   `ref' function, instead of a macro expansion. The solution is to define
   macros before code that uses them

This shows up in LilyPond initialization as
.
.
[/home/ian/lilypond/out/share/lilypond/current/scm/ly-syntax-constructors.scm]
[/home/ian/lilypond/out/share/lilypond/current/scm/define-context-properties.scm]
[/home/ian/lilypond/out/share/lilypond/current/scm/translation-functions.scm;;; note: autocompilation is et GUILE_AUTO_COMPILE=0
;;;       or pass the --no-autocompile argument to disable.
;;; compiling /home/ian/lilypond/scm/translation-functions.scm

error: Not a markup command: line
        compiling markup expression
        (#:line (#:slashed-digit figure))

Patrick has prototyped a solution which reorders the load-order and restructures the declaration of the markup commands.  This tracker is to merge the code into the master repository.

Related

Issues: #1826

Discussion

1 2 > >> (Page 1 of 2)
  • Google Importer

    Google Importer - 2010-10-20

    Originally posted by: pnorcks@gmail.com

    Hi Ian,

    As far as I can tell, my solution works fine, but it is really hacked together.

    IWBN if we can reorganize the macros and procedures so that everything is still organized and coherent.

     
  • Google Importer

    Google Importer - 2011-02-10

    Originally posted by: ianhuli...@gmail.com

    Jan has tweaked some of this stuff in commit [r05514c83a49dd3dfabd1fa7774c69c3038ecde6b] ,
    Author: Jan Nieuwenhuizen <janneke@gnu.org>
    Date:   Wed Feb 2 11:18:28 2011 +0100

        Guile-1.9 compatibility fixes.
       
          * remove #:use-syntax
          * rewrite curried definitions
          * change order of loading .scm files so that
            markups are defined before used in code

     
  • Google Importer

    Google Importer - 2011-02-16

    Originally posted by: pnorcks@gmail.com

    Ian,

    Jan did move a couple of functions around, but I still ran into compile failures as a result of markup expressions being undefined.

    The reordering commits from my guile branch still "work", so I'll start cleaning them up to make the diff as minimal as possible.

    Owner: pnorcks
    Cc: -pnorcks -n.puttock -Carl.D.Sorensen -hanwenn
    Status: Started

     
  • Google Importer

    Google Importer - 2011-02-16

    Originally posted by: pnorcks@gmail.com

    (No comment was entered for this change.)

    Summary: Guile 2.0 compat: Scheme macros must be defined/autocompiled before they are used.

     
  • Google Importer

    Google Importer - 2011-03-16

    Originally posted by: jan.nieuwenhuizen

    @pnorcks: how is this coming along?
    LilyPond is now not even buildable anymore with latest guile stable-2.0

    If you have a diff that works with current HEAD, I'd like to experiment
    with that in GUB's guile 2.0 branch.

     
  • Google Importer

    Google Importer - 2011-03-17

    Originally posted by: jan.nieuwenhuizen

    I found git://repo.or.cz/lilypond/patrick.git

    Any reason for not doing this on savannah, on dev/patrick ?

     
  • Google Importer

    Google Importer - 2011-03-17

    Originally posted by: pnorcks@gmail.com

    Thanks for the suggestion.  dev/patrick is now on savannah.

    I just test-compiled LilyPond against guile commit 900a6f87bad on the stable-2.0 branch, with mixed results.  The first two attempts ended in a segfault, and the third attempt succeeded.

    I'll have to take a closer look... it seems that (since 2.0) Guile is more strict with regard to this whole macro issue.  I didn't see this problem with the official Guile 2.0 release.

     
  • Google Importer

    Google Importer - 2011-03-18

    Originally posted by: jan.nieuwenhuizen

    Thanks.

    FWIW, I used it for schikkers list and I haven't seen any segfaults,
    guile stable-2.0: f80ed1be

    I was almost going to suggest to push it to master.

     
  • Google Importer

    Google Importer - 2011-03-19

    Originally posted by: pnorcks@gmail.com

    Thanks, Jan.  I don't see segfaults anymore with the snapshot from that commit.

    With regard to merging the reordering stuff into master, I think it's actually hanging by a needle and thread... So, not yet.  :)

     
  • Google Importer

    Google Importer - 2011-06-21

    Originally posted by: ianhuli...@gmail.com

    I've started work on Issue 1686 to allow us to compile our scm/*.scm files to scm/out/*.go and have come across another "feature".  It looks like we have .scm files in the list loaded by lily.scm that have dependencies on other .scm files earlier in the list (e.g. markup.scm defining markup?).

    I think we need to do some janitor work so that definitions used like this are defined in lily-library.scm (which is the first file loaded in the list).

    Cheers,
    Ian

    Cc: jan.nieuwenhuizen

     

    Related

    Issues: #1686

  • Google Importer

    Google Importer - 2011-06-21

    Originally posted by: percival.music.ca@gmail.com

    would it be possible to just change the order of files in the makefile?  Or maybe have a
    SCM_ARE_DEPENDENCIES=
    variable (which are compiled before attempting the other scm files), or something?  I'm not certain that including markups in lily-library.scm simply to work around a build system issue is a good solution.

     
  • Google Importer

    Google Importer - 2011-06-21

    Originally posted by: ianhuli...@gmail.com

    What I'm doing in T1686 is adding support for a -d compile-scheme option, which will get lily.scm to byte-compile all the files which are currently loaded in the init-scheme-files list. We need to do it this way so we can have all the Scheme definitions available which are defined in the C++ initialization code etc.

    I can't see a way of picking up a build system variable like SCM_ARE_DEPENDENCIES at run-time.

    However we do it, it looks like the ordering of this list needs sorting.

    Cc: percival.music.ca@gmail.com

     
  • Google Importer

    Google Importer - 2011-06-21

    Originally posted by: pnorcks@gmail.com

    Ian, check out my dev/patrick branch and see if any files from scm/ still fail to compile.

    I haven't tested this in a while, so something may have broken again...

     
  • Google Importer

    Google Importer - 2011-07-18

    Originally posted by: ianhuli...@gmail.com

    Hi,
    I've been doing some testing in conjunction with Issue 1686.  I can get all the files to load OK in the call from ly_c_init_guile (where lily.scm itself is loaded) but it then fails in the later call to lilypond-main in lily.scm.

    Here's the tail of a --verbose run.  At the moment it fails with both Guile 1.8 and 2.0. 

    Building font database...

    Processing `test.ly'
    Parsing...
    [/home/ian/src/lilypond/build/out/share/lilypond/current/ly/init.ly
    [/home/ian/src/lilypond/build/out/share/lilypond/current/ly/declarations-init.ly
      [/home/ian/src/lilypond/build/out/share/lilypond/current/ly/music-functions-init.ly]
      [/home/ian/src/lilypond/build/out/share/lilypond/current/ly/toc-init.ly
    /home/ian/src/lilypond/build/out/share/lilypond/current/ly/toc-init.ly:25:33: error: syntax error, unexpected MARKUP_FUNCTION, expecting SCM_IDENTIFIER or SCM_TOKEN
      tocTitleMarkup = \markup \huge
                                     \column {
    /home/ian/src/lilypond/build/out/share/lilypond/current/ly/toc-init.ly:27:4: error: unknown escaped string: `\hspace'
       
        \hspace #1
    /home/ian/src/lilypond/build/out/share/lilypond/current/ly/toc-init.ly:28:2: error: syntax error, unexpected '}', expecting '='
     
      }
    /home/ian/src/lilypond/build/out/share/lilypond/current/ly/toc-init.ly:29:37: error: syntax error, unexpected '{', expecting SCM_IDENTIFIER or SCM_TOKEN
      tocItemMarkup = \markup \fill-line
                                         {
    ERROR: In procedure apply:
    ERROR: Wrong type argument in position 1: #<undefined>
    ian@nanny-ogg:~/src/lilypond/build$

    I've put the current patch for this and T1686 on Rietveld as
    http://codereview.appspot.com/4760049.
    Any ideas for progressing with this would be appreciated, as otherwise I'm stuck at the moment.

    Cheers, Ian Hulin

    Cc: Carl.D.S...@gmail.com

     

    Related

    Issues: #1686

  • Google Importer

    Google Importer - 2011-08-10

    Originally posted by: ianhuli...@gmail.com

    Disentangled load order issues from other Guile V2 issues. Running with Guile 1.8.7 now passes make and regtests.

    Patch available for review

    http:://codereview/appspot.com/4849054

    Ian Hulin

    Labels: Patch-review

     
  • Google Importer

    Google Importer - 2011-08-16

    Originally posted by: ianhuli...@gmail.com

    The patch needs modifying to handle upstream changes to scm/lily.scm for logging and tracing introduced by Reinhold.

    I'll also have another attempt at moving the Scheme definition of markup to
    scm/markup-macros.scm as per Neil's suggestion in the Rietveld review.

    Cc: n.putt...@gmail.com

     
  • Google Importer

    Google Importer - 2011-08-16

    Originally posted by: ianhuli...@gmail.com

    (No comment was entered for this change.)

    Labels: -Patch-review Patch-needs_work

     
  • Google Importer

    Google Importer - 2011-08-16

    Originally posted by: reinhold...@gmail.com

    Is there any way I can help with rebasing/updating that patch after my changes?
    Reinhold

     
  • Google Importer

    Google Importer - 2011-08-16

    Originally posted by: ianhuli...@gmail.com

    Reinhold,
    No problems, it's merged OK.  I just wanted to make sure I didn't stamp on any of your upstream changes for loglevel.

    Neil,
    I have had another try at moving the markup definition to markup-macros.scm but it regresses the change when running when running with V2. 

    I'm happy with Patchset 7 going for countdown.

    Ian

    Labels: -Patch-needs_work Patch-review
    Cc: reinhold...@gmail.com

     
  • Google Importer

    Google Importer - 2011-08-18

    Originally posted by: pnorcks@gmail.com

    Ian is handling this issue.

    Owner: ianhuli...@gmail.com

     
  • Google Importer

    Google Importer - 2011-08-20

    Originally posted by: ianhuli...@gmail.com

    Hi Graham,
    I would push the patch myself, but I can't get the ssh connection to
    Savannah to work :-{.

    I followed the instructions from the CG you sent re git push access. 
    I've tried generating and using both dsa and rsa public keys, and
    entering them on the Savannah My Account/Account Configuration page,
    but I still can't get git pull --verbose to work. This is frustrating -
    grrrrr...

     
  • Google Importer

    Google Importer - 2011-08-20

    Originally posted by: percival.music.ca@gmail.com

    (No comment was entered for this change.)

    Labels: -Maintainability Type-Maintainability

     
  • Google Importer

    Google Importer - 2011-08-20

    Originally posted by: percival.music.ca@gmail.com

    (No comment was entered for this change.)

    Labels: -Type-Maintainability Type-Enhancement

     
  • Google Importer

    Google Importer - 2011-08-22

    Originally posted by: ianhuli...@gmail.com

    Pushed as commit - [rf41963f0b6135c02c363f8401628e85b9bc60def]
    Thanks to Carl for facilitating this,

    Cheers Ian

    Status: Fixed

     
1 2 > >> (Page 1 of 2)