<div dir="ltr">Yeah, I am pretty sure I have no choice but trigger an event when the code requests input. I think Python is just much more flexible - you can probably just substitute something that isn't a file for sys.stdin, and when you call getline() on it it just does what it needs to. Flexible dynamic languages and all that. <div>

<br></div><div>That's an interesting way to go about it. Will look into it, maybe. So far I've been browsing the source of GHC.IO.Handle in the hopes of finding a way to do this - maybe use the underlying IORefs in the Handle_ constructor for the Handle data type in order to unsafeCoerce something... I don't even know. I'm beginning to think this is just more or less impossible, though.</div>

</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Jan 5, 2014 at 3:42 PM, Rogan Creswick <span dir="ltr"><<a href="mailto:creswick@gmail.com" target="_blank">creswick@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="im"><div class="gmail_extra"><div class="gmail_quote">On Sun, Jan 5, 2014 at 12:19 PM, Andrew Gibiansky <span dir="ltr"><<a href="mailto:andrew.gibiansky@gmail.com" target="_blank">andrew.gibiansky@gmail.com</a>></span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">That's a good idea, but there's no IPython input channel. Instead, the backend (my interpreter) has to *request* input from the frontend, which then supplies this input. The input is entered via a web browser, so there's not even a handle or file descriptor to speak of.</div>





</div>
</blockquote></div><br></div></div><div class="gmail_extra">Ugh, so you really do need to trigger an event when the code in the cell requests input.  How does python handle this?</div><div class="gmail_extra"><br></div><div class="gmail_extra">



Here's a horrible idea, but in the spirit of brainstorming... you could run the cell code in a separate app (fork off your interpreter), using ptrace (for linux; I'm not sure how to do this on other OSes) to detect system calls that involve stdin, and then supply input based on that.</div>



<div class="gmail_extra"><br></div><div class="gmail_extra">Aside from being tricky to do for all platforms, that's also going to have a horrible user experience for any code that loops over std in rapidly to get what would otherwise appear as a single input to the user, but I'm grasping at straws...</div>

<span class="HOEnZb"><font color="#888888">

<div class="gmail_extra"><br></div><div class="gmail_extra">--Rogan</div></font></span></div>
</blockquote></div><br></div>