unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Neil Jerram <neil@ossau.uklinux.net>
To: Remco Bras <vrsoft@gmail.com>
Cc: guile-user@gnu.org
Subject: Re: Can scm_shell be interrupted?
Date: Mon, 12 May 2008 21:43:53 +0100	[thread overview]
Message-ID: <87prrruuba.fsf@ossau.uklinux.net> (raw)
In-Reply-To: <200805102254.59603.vrsoft@gmail.com> (Remco Bras's message of "Sat, 10 May 2008 22:54:59 +0200")

Remco Bras <vrsoft@gmail.com> writes:

> Hello,
>
> I have a question about guile. I'd like to know if it is feasible to run a 
> guile REPL and control when it runs. For example, consider the following 
> scenario. A package may or may not have a thread running scm_shell, when the 
> user requests that the package runs an REPL. The package responds by running 
> scm_shell in a thread and keeping that thread's ID. If the user wants the 
> package to stop the REPL at any moment, is there a way to do this safely? 

Where does the REPL's input come from?

If its stdin, being read in a blocking way (as is the default), it
would be tricky if the REPL thread did the read directly.  But you
could have a special stdin-reader thread, responsible for reading and
buffering lines of input, and then supplying them to whichever REPL
runs next.

What happens if the user wants to stop a package's REPL when the user
has already typed half a line of input into that REPL?

It might also be possible to make stdin non-blocking, and use select
to avoid trying to read before there is a whole line available.

If its a GUI app, it becomes less a matter of a REPL reading from a
port, and more a matter of a widget collecting input which can then be
passed into the REPL.  (Although the two approaches can be reconciled;
see graphical-repl.scm in guile-gnome.)  I think that fits slightly
more naturally with your idea of a selectable REPL, so may be easier
to implement in your app.

In summary: lots of options, need more detail about how your overall
app works and what you want it to look like.

Regards,
     Neil





  reply	other threads:[~2008-05-12 20:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-10 20:54 Can scm_shell be interrupted? Remco Bras
2008-05-12 20:43 ` Neil Jerram [this message]
2008-05-16 15:29   ` Remco Bras
  -- strict thread matches above, loose matches on Subject: below --
2008-05-16 16:29 Remco Bras
2008-06-01 21:58 ` Neil Jerram

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=87prrruuba.fsf@ossau.uklinux.net \
    --to=neil@ossau.uklinux.net \
    --cc=guile-user@gnu.org \
    --cc=vrsoft@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).