For some reason I could not reply to the original thread...

Begin forwarded message:

> From: "Stephen C. Gilardi" <squee...@mac.com>
> Date: February 6, 2009 12:49:34 PM EST
> To: Eric Thorsen <ethor...@enclojure.org>
> Subject: Re: Patch: universal main() with repl/script/compile
>
> Hi Eric,
>
>> I've been using the repl in clojure,main (which is great, BTW) but I
>
> Thanks!
>
>> have a question as to why the main loop is not a "pure" REPL?
>> I am able to substitute all parts except that the *in* stream is
>> mucked with in the loop with the skip-whitepace and skip-if-eol which
>> means if I do not want that stuff to happen, I am out of luck.  Can
>> you shed some light on the problem you were trying to solve there and
>> whether or not that logic can be moved into the default read function
>> instead of being inside the loop?
>
> Regarding skip-whitespace:
>
> Good questions. clojure.core/read already does skip-whitespace  
> internally so you won't be avoiding that as long as you use it. The  
> downside of clojure.core/read doing that (rather than something I  
> control in the repl) is that clojure.core/read doesn't return at end- 
> of-line. One goal of making a nicer repl was to prompt for each  
> line: if the user types a blank line, give another prompt. That  
> isn't possible if I leave the current clojure.core/read in charge of  
> skipping whitespace. It considers the end-of-line as just more  
> whitespace and continues skipping.
>
> Another goal was not to prompt again if there's more input on the  
> same line. Arguably, printing only the last value on the line would  
> also be correct (making each line (at least logically) a "do"), but  
> I found the following old behavior kind of annoying/confusing/ 
> unsightly:
>
> user=> 1 2 3
> 1
> user=> 2
> user=> 3
> user=>
>
> Regarding skip-if-eol:
>
> The call to skip-if-eol is to support (read-line) (and other input  
> stream reads) from the repl. In many cases, command interpreters  
> (like unix shells) consume the eol that terminates a line so that  
> other code can read from the input stream "cleanly". If I don't do  
> skip-if-eol, the response from (read-line), for example, will always  
> be blank (when typed on a line by itself) because the eol will still  
> be on the input stream.
>
> I'll look at working these operations into a repl-read function so  
> they can be overridden/elided. It looks now like that that function  
> will probably need an end-of-stream argument and an end-of-line  
> argument passed in as sentinel values to return on those occasions.  
> (see clojure.main/eof).
>
> Thanks for the feedback. I'll look at this tonight or over the  
> weekend. If you have any further ideas or suggestions, I'll be happy  
> to hear them and to answer any questions.
>
> Thanks,
>
> --Steve
>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to