Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Getting a char from stdin without waiting for "\n"

0 views
Skip to first unread message

Dan Sugalski

unread,
Oct 13, 2004, 12:48:51 PM10/13/04
to ma...@diephouse.com, perl6-i...@perl.org, Matt Diephouse
At 12:10 PM -0400 10/13/04, Matt Diephouse wrote:
>I'm still working on a new Forth implementation...
>
>Forth has a word `key` that gets one character from stdin. It
>shouldn't wait for a newline to get the character. Is there any way to
>implement this currently in PIR?

I don't think so. The IO system needs a good design swampout and
implementation. I think I'll have some time this evening to dust off
the IO/Event doc and give it another edit, and then we can see about
getting things written.
--
Dan

--------------------------------------it's like this-------------------
Dan Sugalski even samurai
d...@sidhe.org have teddy bears and even
teddy bears get drunk

Aaron Sherman

unread,
Oct 13, 2004, 12:49:13 PM10/13/04
to ma...@diephouse.com, Perl6 Internals List
On Wed, 2004-10-13 at 12:10, Matt Diephouse wrote:
> I'm still working on a new Forth implementation...
>
> Forth has a word `key` that gets one character from stdin. It
> shouldn't wait for a newline to get the character. Is there any way to
> implement this currently in PIR?

You can't do this in a standard, portable way in C, so I doubt that PIR
has such a mechanism. Here's a reference from the comp.lang.c FAQ:

http://www.eskimo.com/~scs/C-faq/q19.1.html

--
781-324-3772
a...@ajs.com
http://www.ajs.com/~ajs

Dan Sugalski

unread,
Oct 13, 2004, 12:58:14 PM10/13/04
to Perl6 Internals List
At 12:49 PM -0400 10/13/04, Aaron Sherman wrote:
>On Wed, 2004-10-13 at 12:10, Matt Diephouse wrote:
>> I'm still working on a new Forth implementation...
>>
>> Forth has a word `key` that gets one character from stdin. It
>> shouldn't wait for a newline to get the character. Is there any way to
>> implement this currently in PIR?
>
>You can't do this in a standard, portable way in C, so I doubt that PIR
>has such a mechanism.

Hell, you can't do useful IO in a portable way period. Which is why
we're not going to. :-P

Parrot wedges code between the system and the interpreter to provide
a portable async IO layer, or at least we will once that gets done.

0 new messages