3

I'm playing with Futures in Io. I have some methods that do some work:

a := method(10 + 20)
b := method(20 + 30)
c := method(30 + 40)

And I want to run them concurrently. This works as expected:

m := method(list(@a, @b, @c))

f := @m
writeln((f join(" + ")) .. " = " .. f sum)

However, moving the work of creating the string into method m does not work:

m := method(
    s := list(@a, @b, @c)
    ((s join(" + ")) .. " = " .. (s sum))
)

f := @m
writeln(f)

This raises Scheduler: nothing left to resume so we are exiting.

Why? What have I not understood?

Dave Nolan
  • 3,009
  • 4
  • 30
  • 32

3 Answers3

1

It's a bug in the interactive interpreter. If you put your code in a file it should work fine.

Steve Dekorte
  • 79
  • 1
  • 4
0

I don't have an answer to your question, but I believe that this error is independent of your problem since I encountered it doing much more simple work in the interpreter.

Io> 1 proto
==> 0
Io> 5 proto
==> 0
Io> 0 proto
==> 0
Scheduler: nothing left to resume so we are exiting
  ---------
  Coroutine callStack                  A4_Exception.io 244
  Coroutine backTraceString            A4_Exception.io 274
  Coroutine showStack                  A4_Exception.io 177
  Coroutine pause                      A4_Exception.io 286

Then I tried the command again and it worked fine:

╰─➤  io
Io 20110905
Io> 0 proto
==> 0
nichochar
  • 2,720
  • 1
  • 18
  • 16
-1

In io source code dir:

  1. rm ./libs/iovm/source/IoVMInit.c
  2. open ./libs/iovm/io/A4_Exception.io and uncomment this line //Exception raise("Scheduler: nothing left to resume so we are exiting")
  3. rebuild and reinstall
zheolong
  • 31
  • 6