Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How cancel a message in Io's REPL without leaving the REPL? #441

Open
halloleo opened this issue Nov 19, 2020 · 6 comments
Open

How cancel a message in Io's REPL without leaving the REPL? #441

halloleo opened this issue Nov 19, 2020 · 6 comments

Comments

@halloleo
Copy link

I'm using Io's REPL to get more familiar with the language.

When I issue a loop which - by accident - doesn't have a break condition, I have to stop the loop somehow.

Say, I issue in its simplest way

loop("foo" println)

How can I stop the loop with the keyboard without killing the whole REPL?

Ctrl-C stops the loop, but kills normally the REPL as well. Is there a way to stay in Io's REPL after Ctrl-C?

@halloleo halloleo changed the title How cancel a message in the Io REPL whithout leving teh REPL? How cancel a message in Io's REPL whithout leaving the REPL? Nov 19, 2020
@halloleo halloleo changed the title How cancel a message in Io's REPL whithout leaving the REPL? How cancel a message in Io's REPL without leaving the REPL? Nov 19, 2020
@ales-tsurko
Copy link
Member

AFAIK, this is not implemented by default. But you can add your own system interrupt handler by implementing System userInterruptHandler.

@stevedekorte
Copy link
Member

Now I understand why python has control-c and control-d. I guess it would be nice if Io worked the same way.

@halloleo
Copy link
Author

Hey, so glad to get a response. :-) Tried to hang out on IRC #io, but something most have gone wrong...

@ales-tsurko System userInterruptHandler looks cool! Is there way to print its current method implementation in the Io repl? (I think I saw something like this in the doco, but now I cannot find it!)

@ales-tsurko
Copy link
Member

Here we go:

Io> System getSlot("userInterruptHandler") code
==> method(writeln("\n  current coroutine") ;
Scheduler currentCoroutine showStack ;
Scheduler yieldingCoros foreach(coro, writeln("  coroutine ", coro label) ;
coro showStack) ;
self exit)
Io>

BTW, @stevedekorte how about adding an official chat on Discord or somewhere else?

@halloleo
Copy link
Author

Thanks @ales-tsurko!

getSlot code was it!

Re official chat: What about a channel on gitter? It aligns well with GutHub and has some message history.

@stevedekorte
Copy link
Member

There's a slack https://join.slack.com/t/iolanguage/shared_invite/zt-jgv7a478-onIqvPzhgUgDMOdqX5ChAw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants