read-line-evt question

32 views
Skip to first unread message

Javier Vivanco

unread,
Nov 18, 2020, 9:43:55 AM11/18/20
to Racket Users

Hi  everybody.

I have a question about a read-line-evt 's behaviour.
Is this normal this ?
> (sync (read-line-evt (current-input-port))
1234
"1111"

I want to use a timeout in read-line via sync/timeout

but it always gives me the first character

Thanks

George Neuner

unread,
Nov 18, 2020, 12:59:55 PM11/18/20
to Javier Vivanco, racket users
You are seeing the return value from 'sync' rather than the event data.

Contrast with:

  (let [ (e (read-line-evt (current-input-port) )) ]
    (sync e)
    e )

Hope this helps,
George

Matthew Flatt

unread,
Nov 18, 2020, 2:09:01 PM11/18/20
to racket users, Javier Vivanco
At Wed, 18 Nov 2020 12:59:46 -0500, George Neuner wrote:
>
> On 11/18/2020 9:43 AM, Javier Vivanco wrote:
> >
> > I have a question about a read-line-evt 's behaviour.
> > Is this normal this ?
> > > (sync (read-line-evt (current-input-port))
> > 1234
> > "1111"
> >
> > I want to use a timeout in read-line via sync/timeout
> >
> > but it always gives me the first character
> >
>
> You are seeing the return value from 'sync' rather than the event data.

I think that was the intent, though, and I think the expected answer is
"1234". But I see that the `read-line-evt` function is not working
right when a port supplies one byte for each peek, which is what
happens in DrRacket.

We'll get this fixed. Thanks for the report!


Matthew
Reply all
Reply to author
Forward
0 new messages