unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Alan Manuel Gloria <almkglor@gmail.com>
To: Noah Lavine <noah.b.lavine@gmail.com>
Cc: guile-devel@gnu.org
Subject: Re: Adding to guile curly-infix (SRFI 105), neoteric- & sweet-expressions
Date: Tue, 28 Aug 2012 14:56:22 +0800	[thread overview]
Message-ID: <CAF+kUQWYu8UqiK4siyYFy4nio6sQJCniJ_HkNdPwEg55TGk=Mw@mail.gmail.com> (raw)
In-Reply-To: <CA+U71=OB5006j6KqWY4uzFPmo1Kui9BEmkrbNd0E30=j6YePnQ@mail.gmail.com>

On Tue, Aug 28, 2012 at 10:57 AM, Noah Lavine <noah.b.lavine@gmail.com> wrote:
> Hello,
>
> On Mon, Aug 27, 2012 at 12:30 AM, Alan Manuel Gloria <almkglor@gmail.com> wrote:
>> However, it leads to an edge case in Guile 2.0 where disabling
>> autocompilation leads to the module-loading C code path going through
>> a direct C call to the C implementation of primitive-load, a path that
>> only triggers if autocompilation disabled (when autocompilation is
>> enabled, it goes through a hook in the language support for Scheme,
>> which uses the 'read function we've rebound).
>
> Hmm, interesting. That sounds like a bug, but I'd like one of the
> Guile maintainers to clarify that this isn't intended before I look at
> it more. Is this triggered when you're trying to load a module full of
> infix expressions?

Yes, with autocompilation off.

> If so, how do you tell Guile that the module is
> supposed to use infix expressions instead of s-expressions?

By re-binding (via set!) 'read and 'primitive-load.  On Guile 1.6 and 1.8,
IIRC the C code uses the binding for 'primitive-load to handle loading
module loading.  On Guile 2.0, the compilation hook for the Scheme
language uses the 'read Scheme binding (IIRC).  Replacing the 'read
and 'primitive-load bindings works for 1.6 and 1.8, and 2.0 with
autocompilation enabled.

With autocompilation off, Guile ends up calling the primitive-load
C implementation directly as a C call, instead of the old behavior
of calling 'primitive-load in the Scheme side.

Our strategy, basically, was to completely replace the reader, as
that had seemed to work in 1.6 and 1.8 at the REPL.  I modified
it later to replace 'primitive-load too, so that 'primitive-load uses
the Scheme binding for 'read, which made it work in 1.6 and 1.8
during module loading.

Sincerely,
AmkG



  reply	other threads:[~2012-08-28  6:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-26 17:02 Adding to guile curly-infix (SRFI 105), neoteric- & sweet-expressions David A. Wheeler
2012-08-27  2:11 ` nalaginrut
2012-08-27  4:16   ` David A. Wheeler
2012-08-27  4:30     ` Alan Manuel Gloria
2012-08-28  2:57       ` Noah Lavine
2012-08-28  6:56         ` Alan Manuel Gloria [this message]
2012-08-27 11:20 ` Marijn
2012-09-01  3:16   ` David A. Wheeler
2012-08-28 20:43 ` Ludovic Courtès
2012-08-29  1:49   ` David A. Wheeler
2012-08-29  7:54     ` Alan Manuel Gloria

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='CAF+kUQWYu8UqiK4siyYFy4nio6sQJCniJ_HkNdPwEg55TGk=Mw@mail.gmail.com' \
    --to=almkglor@gmail.com \
    --cc=guile-devel@gnu.org \
    --cc=noah.b.lavine@gmail.com \
    /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).