unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* support thunks as prompts without readline
@ 2008-05-09 14:43 Andy Wingo
  2008-05-09 22:36 ` Neil Jerram
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Wingo @ 2008-05-09 14:43 UTC (permalink / raw)
  To: guile-devel

[-- Attachment #1: Type: text/plain, Size: 5 bytes --]

Hi,


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: thunks as patches quoi --]
[-- Type: text/x-patch, Size: 779 bytes --]

From 69fc67efaad628a866e14ead4cb96f102316b82b Mon Sep 17 00:00:00 2001
From: Andy Wingo <wingo@pobox.com>
Date: Fri, 9 May 2008 16:42:44 +0200
Subject: [PATCH] support thunks as prompts, as readline does.

* ice-9/boot-9.scm (repl-reader): Support thunks as prompts.
---
 ice-9/boot-9.scm |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ice-9/boot-9.scm b/ice-9/boot-9.scm
index d1e6306..b92cfd6 100644
--- a/ice-9/boot-9.scm
+++ b/ice-9/boot-9.scm
@@ -2518,7 +2518,7 @@
 ;;; the readline library.
 (define repl-reader
   (lambda (prompt)
-    (display prompt)
+    (display (if (string? prompt) prompt (prompt)))
     (force-output)
     (run-hook before-read-hook)
     ((or (fluid-ref current-reader) read) (current-input-port))))
-- 
1.5.5-rc2.GIT


[-- Attachment #3: Type: text/plain, Size: 25 bytes --]

-- 
http://wingolog.org/

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: support thunks as prompts without readline
  2008-05-09 14:43 support thunks as prompts without readline Andy Wingo
@ 2008-05-09 22:36 ` Neil Jerram
  2008-05-12 19:15   ` Andy Wingo
  0 siblings, 1 reply; 4+ messages in thread
From: Neil Jerram @ 2008-05-09 22:36 UTC (permalink / raw)
  To: Andy Wingo; +Cc: guile-devel

Andy Wingo <wingo@pobox.com> writes:

> * ice-9/boot-9.scm (repl-reader): Support thunks as prompts.
> ---
>  ice-9/boot-9.scm |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/ice-9/boot-9.scm b/ice-9/boot-9.scm
> index d1e6306..b92cfd6 100644
> --- a/ice-9/boot-9.scm
> +++ b/ice-9/boot-9.scm
> @@ -2518,7 +2518,7 @@
>  ;;; the readline library.
>  (define repl-reader
>    (lambda (prompt)
> -    (display prompt)
> +    (display (if (string? prompt) prompt (prompt)))
>      (force-output)
>      (run-hook before-read-hook)
>      ((or (fluid-ref current-reader) read) (current-input-port))))

I don't get this one.  Isn't the thunk option already covered by the
code that calls repl-reader, here:

			   (let ((prompt (cond ((string? scm-repl-prompt)
						scm-repl-prompt)
					       ((thunk? scm-repl-prompt)
						(scm-repl-prompt))
					       (scm-repl-prompt "> ")
					       (else ""))))
			     (repl-reader prompt))))

Regards,
     Neil





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: support thunks as prompts without readline
  2008-05-09 22:36 ` Neil Jerram
@ 2008-05-12 19:15   ` Andy Wingo
  2008-05-12 20:25     ` Neil Jerram
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Wingo @ 2008-05-12 19:15 UTC (permalink / raw)
  To: Neil Jerram; +Cc: guile-devel

Hey Neil,

On Sat 10 May 2008 00:36, Neil Jerram <neil@ossau.uklinux.net> writes:

> Andy Wingo <wingo@pobox.com> writes:
>
>> * ice-9/boot-9.scm (repl-reader): Support thunks as prompts.
>> ---
>>  ice-9/boot-9.scm |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/ice-9/boot-9.scm b/ice-9/boot-9.scm
>> index d1e6306..b92cfd6 100644
>> --- a/ice-9/boot-9.scm
>> +++ b/ice-9/boot-9.scm
>> @@ -2518,7 +2518,7 @@
>>  ;;; the readline library.
>>  (define repl-reader
>>    (lambda (prompt)
>> -    (display prompt)
>> +    (display (if (string? prompt) prompt (prompt)))
>>      (force-output)
>>      (run-hook before-read-hook)
>>      ((or (fluid-ref current-reader) read) (current-input-port))))
>
> I don't get this one.  Isn't the thunk option already covered by the
> code that calls repl-reader, here:
>
> 			   (let ((prompt (cond ((string? scm-repl-prompt)
> 						scm-repl-prompt)
> 					       ((thunk? scm-repl-prompt)
> 						(scm-repl-prompt))
> 					       (scm-repl-prompt "> ")
> 					       (else ""))))
> 			     (repl-reader prompt))))

Sorry for the long quote. Answer: It does seem that this case is covered
by the scm-style REPL. I'm trying to use the repl-reader for a different
repl, the one in guile-vm. The (ice-9 readline) repl-reader does handle
the prompt-as-thunk case. I just want them both to act the same :)

I could change to call the thunk instead, if that's the best option.
Please advise as to what you want to accept.

Andy
-- 
http://wingolog.org/




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: support thunks as prompts without readline
  2008-05-12 19:15   ` Andy Wingo
@ 2008-05-12 20:25     ` Neil Jerram
  0 siblings, 0 replies; 4+ messages in thread
From: Neil Jerram @ 2008-05-12 20:25 UTC (permalink / raw)
  To: Andy Wingo; +Cc: guile-devel

Andy Wingo <wingo@pobox.com> writes:

>> 			   (let ((prompt (cond ((string? scm-repl-prompt)
>> 						scm-repl-prompt)
>> 					       ((thunk? scm-repl-prompt)
>> 						(scm-repl-prompt))
>> 					       (scm-repl-prompt "> ")
>> 					       (else ""))))
>> 			     (repl-reader prompt))))
>
> Sorry for the long quote. Answer: It does seem that this case is covered
> by the scm-style REPL. I'm trying to use the repl-reader for a different
> repl, the one in guile-vm. The (ice-9 readline) repl-reader does handle
> the prompt-as-thunk case. I just want them both to act the same :)
>
> I could change to call the thunk instead, if that's the best option.
> Please advise as to what you want to accept.

What about moving the cond above from the caller to inside
repl-reader?  I'd be happy with that, and I think it would meet your
needs, wouldn't it?

    Neil





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-05-12 20:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-09 14:43 support thunks as prompts without readline Andy Wingo
2008-05-09 22:36 ` Neil Jerram
2008-05-12 19:15   ` Andy Wingo
2008-05-12 20:25     ` Neil Jerram

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).