From: David Kastrup <dak@gnu.org>
To: guile-devel@gnu.org
Subject: Re: summary: lilypond, lambda, and local-eval
Date: Fri, 16 Dec 2011 10:16:43 +0100 [thread overview]
Message-ID: <87ehw4511g.fsf@fencepost.gnu.org> (raw)
In-Reply-To: 87aa6skika.fsf@netris.org
Mark H Weaver <mhw@netris.org> writes:
> I wrote:
>> For now, I will describe a method that I suspect would do the right
>> thing without any new compiler interfaces, though not as efficiently or
>> robustly: Simply compile the same general-purpose dispatcher as before,
>> except replace the #f (from the first case-lambda clause) with the
>> expanded local expression:
>
> Although this should result in the same set of captured lexicals, it
> does not necessarily guarantee that the closure slots will be in the
> same order. This could be perhaps be solved by always sorting the
> captured lexicals by name, but that would slow down the compiler.
> Depending on how the compiler works, it might be sufficient to move the
> <expanded-local-expression> case to end of the case-lambda, but that's
> definitely fragile.
>
> So, I guess this all shows that `local-eval' really shouldn't be
> implemented this way, but rather by creating a new internal interface to
> the compiler that ensures that the closure slots are exactly the same as
> before.
>
>> Most passes of the compiler will pretend that (the-environment) is
>> replaced by tree-il code corresponding to the following standard scheme
>> code:
>
> I should also mention that perhaps, instead of simply "pretending", it
> might make sense to actually replace (the-environment) with the standard
> scheme code I gave as early as possible, so that later passes will never
> even see `the-environment' tree-il nodes. It need only be late enough
> so that the list of visible lexical variable names is known at that
> point.
>
> Apologies for sending multiple messages so quickly.
> Obviously this is a work-in-progress :)
And I consider this _very_ exciting work in progress. One of the things
that the current development line of GCC markets is "compiler plugins".
Here GUILE has an opportunity to offer similar functionality in a
natural, Scheme-like manner with little complexity exposed to the user
of this feature, and apparently not all that much complexity needed to
get added to the compiler: it is more a matter of factoring the
complexity that has to be there anyway in a proper way. Which actually
might make the compiler code easier to understand und modify even if you
don't end up using local-eval.
Being able to employ this in Lilypond to simplify things would certainly
be a nice side benefit, but this has the potential to simplify and
facilitate quite more complex scenarios with simple tools.
It would be _much_ _much_ simpler to use than GCC plugins. And the
better it integrates with the compiler as a whole, the less reason would
be there _not_ to use it whenever it might be useful.
--
David Kastrup
next prev parent reply other threads:[~2011-12-16 9:16 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
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 [this message]
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=87ehw4511g.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).