unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: David Kastrup <dak@gnu.org>
To: guile-devel@gnu.org
Subject: Re: summary: lilypond, lambda, and local-eval
Date: Thu, 15 Dec 2011 15:46:15 +0100	[thread overview]
Message-ID: <87aa6t7v0o.fsf@fencepost.gnu.org> (raw)
In-Reply-To: 87r506uodd.fsf@pobox.com

Andy Wingo <wingo@pobox.com> writes:

> It took some time for everyone to understand the problem.  In the end,
> there were four workable possibilities.
>
>   1) Keep using closures.
>
>   2) Incorporate local-eval and the-environment into Guile 2.0.
>
>   3) Have lilypond use its own evaluator or compiler.
>
>   4) Have lilypond make the embedded lilypond code expand out to actual
>      Scheme.  (It was unclear whether the lilypond grammar allowed
>      this.)

It is pretty clear that the Lilypond grammar will not allow this.  It
has ambiguities that can only be resolved at runtime and impact both the
parse tree as well as the tokenizing process.

> Mark and Noah looked at implementing local-eval, and I recommended
> staying with the closure solution.  Ludovic noted success with method
> (3) in the Skribilo context.

Mark basically showed a sketch that worked by switching off the compiler
of the current top form when the-environment got used.

With LilyPond, my basic statement was that performance of the Scheme
part was a non-issue when compared against the Lilypond parts.  As an
afterthought, this may not be totally correct: if you have code of the
kind

(define-music-function ... (x y z)
  (do a complex calculation purely in Scheme)
  (return results using #{ ... #}))

then the speed of the "calculation" can conceivably govern the runtime
after all, so switching off all compilations in the enclosing top form
might have runtime effects not masked by the costs of #{ ... #}.  It is,
however, untypical to have costly calculations in the front end of
Lilypond.  The runtime is usually spent elsewhere, mostly in C++ code.

> I would like to start a new thread around local-eval, but besides
> that, we should probably agree on the summary first.  So please do
> send any corrections to this summary to the list.  Thanks :)

A note to point 4) if LilyPond were a language for which expansion to
Scheme would be feasible, compilation of the whole nested constructs
would have to happen in one humongous piece since there is no other way
to share lexical environments.

And a note to point 1) the Scheme compiler is more likely to complain
about (lambda () arbitrary-garbage-sexp) than the interpreter when the
preliminary closure-building step picks up line noise from inside of
Lilypond comments or strings.

In comparison to the previous code version running under Guile 1.8,
robustness, cleanliness and manageability of the code have taken a step
backwards.  It's not a mile, but not trivial either.

-- 
David Kastrup




  reply	other threads:[~2011-12-15 14:46 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-15 10:21 summary: lilypond, lambda, and local-eval Andy Wingo
2011-12-15 14:46 ` David Kastrup [this message]
2011-12-15 16:52 ` Hans Aberg
2011-12-15 17:24   ` David Kastrup
2011-12-15 17:52     ` Hans Aberg
2011-12-16  7:35 ` Mark H Weaver
2011-12-16  8:08   ` Mark H Weaver
2011-12-16  8:49   ` Mark H Weaver
2011-12-16  9:16     ` David Kastrup
2011-12-18  7:11     ` Mark H Weaver
2011-12-18 11:27       ` Andy Wingo
2011-12-18 15:32         ` Noah Lavine
2011-12-18 16:19           ` David Kastrup
2011-12-18 21:24             ` Noah Lavine
2011-12-19  9:13         ` Mark H Weaver
2012-01-09 14:44           ` David Kastrup
2011-12-16  9:28   ` Andy Wingo
2011-12-16  9:59     ` David Kastrup
2011-12-16 10:33     ` Mark H Weaver
2011-12-16 12:13       ` Hans Aberg
2011-12-16 12:43         ` David Kastrup
2011-12-16 14:57           ` Hans Aberg
2011-12-21 10:32 ` Ian Hulin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87aa6t7v0o.fsf@fencepost.gnu.org \
    --to=dak@gnu.org \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).