Skip to content

KEY or async handling doesn't play nice when compiled #60

Description

@rlamorea

Maybe I'm trying to do too much, but I'm having a very difficult time getting either KEY or bind or bindAsync to work when inside a compiled word.

Example:

: testit
    ." ENTER A KEY "
     KEY
     ." KEY WAS " .
     ;

testit

What ends up happening is that the window.prompt dialog comes up before anything is emitted, so that prompt text is invisible until I enter a key into the prompt dialog, then it all gets dumped out.

The same thing happens with synchronous or asynchronous bindings -- once inside a compiled word, there is no way (seemingly) to get any sort of interactive session that takes users input inside a word definition.

I don't know if it would work to have a type of bind to an async function that would await its return -- and thereby stop the Forth execution until that is done? (Ideally after dumping any emitted content, though that is something that could be done inside the async function itself if necessary).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions