Re: Proper handling for a custom current-read-interaction?
Alexis King <[email protected]>
| Newsgroups | gmane.comp.lang.racket.user,gmane.lisp.scheme.plt |
|---|---|
| Message-ID | <[email protected]> |
Ah, ok, that (mostly) makes sense to me. I think this might be a little bit complicated, though: in this language, definitions can span multiple lines without necessarily any direct indication that they continue. Think Haskell-style pattern matching: fib 0 = 0 fib 1 = 1 fib n = fib (n - 1) + fib (n - 2) In this case, I actually need to read the whole input to know what a single form should be in the output. Therefore, I’d much rather be handed a user’s entire input, lex the whole thing, parse it, and produce top-level expressions Racket can understand. I’m not sure how to elegantly implement that given the current behavior, since I definitely want to consume multiple lines at a time when possible (i.e. in DrRacket) but if I try and read until an EOF I will block in the REPL. Is there some way around this? It seems like it would be nice for a REPL to communicate if it is operating in multiline mode, in which case input is separated by EOFs, or single line mode, in which case input is separated by newlines. Of course, at that point, it seems like it would likely make sense to simply always send EOFs to avoid the need to check. > On Jun 7, 2016, at 4:56 AM, Robby Findler <[email protected]> wrote: > > The intention here is that you should have a notion of an expression > that is itself consistent and you should read until you get a whole > one of those and then just return that. The different behavior you see > in DrRacket and at the terminal window prompt will, yes, cause > different behavior, but it isn't supposed to be something that you > would explicitly check for and respond to. > > In the case of the DrRacket window, DrRacket makes the assumption that > your expressions will be terminated by an EOF and puts those into the > port between each submission that the user makes in order to support > things like typing alt-return (something that doesn't happen at the > terminal window). > > Robby -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit https://groups.google.com/d/optout.