Arc Forumnew | comments | leaders | submitlogin
2 points by rocketnia 5075 days ago | link | parent

For a second I thought there were no improvements, but then I ran Ant again. :-p Worked like a charm.

I've found another bug for you:

  (pr "Test 5 ")
  (= test5 (tostring:catch:after (throw pr!problem) pr!-free))
  (prn:case test5
    "problem-free"  "succeeded."
    "problem"       "failed with the expected result."
                    "failed with an unexpected result.")
It seems 'after doesn't do much....


1 point by conanite 5070 days ago | link

Fixed, finally. Rainbow had an optimisation that prevented copying the whole stack if it was not necessary upon entering a continuation. Alas, for the sake of the tests, that particular optimisation is gone. If I can figure out how to get it back, I will. This is the somewhat violent test case I developed for continuations in combination with 'protect, based on a previous test for co-routines:

  (accum trace 
    (assign proc-A (fn (my-b)
      (trace 'proc-A-start)
      (assign inner-A (fn (n)
        (trace (sym:string 'inner-A-start- n))
        (after (assign my-b (do (trace 'pre-ccc-my-b) (ccc my-b))) (trace (sym:string 'after-ccc-my-b- n)))
        (trace 'end-inner-A)
        (if (> n 0) (after (inner-A (- n 1)) (trace (sym:string 'after-inner-A-tail-call- n))))))
     (after (inner-A 5) (trace 'after-initial-inner-A-call))))

    (assign proc-B (fn (my-a)
      (trace 'proc-B-start)
      (assign inner-B (fn (x)
        (trace 'inner-B-start)
        (after (assign my-a (do (trace 'pre-ccc-my-a) (ccc my-a))) (trace 'after-ccc-my-a))
        (trace 'end-inner-B)
        (after (inner-B 0) (trace 'after-inner-B-tail-call))))))

    (after (proc-A proc-B) (trace 'final-after)))
Here's the expected output:

  (proc-A-start inner-A-start-5 pre-ccc-my-b proc-B-start after-ccc-my-b-5
   end-inner-A inner-A-start-4 pre-ccc-my-b inner-B-start pre-ccc-my-a
   after-ccc-my-a after-ccc-my-b-4 after-inner-A-tail-call-5
   after-ccc-my-b-5 end-inner-A inner-A-start-4 pre-ccc-my-b
   after-ccc-my-b-4 after-inner-A-tail-call-5 after-ccc-my-a end-inner-B
   inner-B-start pre-ccc-my-a after-ccc-my-a after-inner-B-tail-call
   after-ccc-my-b-4 after-inner-A-tail-call-5 after-ccc-my-b-4 end-inner-A
   inner-A-start-3 pre-ccc-my-b after-ccc-my-b-3 after-inner-A-tail-call-4
   after-inner-A-tail-call-5 after-ccc-my-a end-inner-B inner-B-start
   pre-ccc-my-a after-ccc-my-a after-inner-B-tail-call
   after-inner-B-tail-call after-ccc-my-b-4 after-inner-A-tail-call-5
   after-ccc-my-b-3 end-inner-A inner-A-start-2 pre-ccc-my-b
   after-ccc-my-b-2 after-inner-A-tail-call-3 after-inner-A-tail-call-4
   after-inner-A-tail-call-5 after-ccc-my-a end-inner-B inner-B-start
   pre-ccc-my-a after-ccc-my-a after-inner-B-tail-call
   after-inner-B-tail-call after-inner-B-tail-call after-ccc-my-b-4
   after-inner-A-tail-call-5 after-ccc-my-b-2 end-inner-A inner-A-start-1
   pre-ccc-my-b after-ccc-my-b-1 after-inner-A-tail-call-2
   after-inner-A-tail-call-3 after-inner-A-tail-call-4
   after-inner-A-tail-call-5 after-ccc-my-a end-inner-B inner-B-start
   pre-ccc-my-a after-ccc-my-a after-inner-B-tail-call
   after-inner-B-tail-call after-inner-B-tail-call after-inner-B-tail-call
   after-ccc-my-b-4 after-inner-A-tail-call-5 after-ccc-my-b-1 end-inner-A
   inner-A-start-0 pre-ccc-my-b after-ccc-my-b-0 after-inner-A-tail-call-1
   after-inner-A-tail-call-2 after-inner-A-tail-call-3
   after-inner-A-tail-call-4 after-inner-A-tail-call-5 after-ccc-my-a
   end-inner-B inner-B-start pre-ccc-my-a after-ccc-my-a
   after-inner-B-tail-call after-inner-B-tail-call after-inner-B-tail-call
   after-inner-B-tail-call after-inner-B-tail-call after-ccc-my-b-4
   after-inner-A-tail-call-5 after-ccc-my-b-0 end-inner-A
   after-inner-A-tail-call-1 after-inner-A-tail-call-2
   after-inner-A-tail-call-3 after-inner-A-tail-call-4
   after-inner-A-tail-call-5 after-initial-inner-A-call final-after)
I have no idea whether it is correct; all I can say is that arc3.1 gives the same result. Mere compatibility isn't such a high standard, at least in this case :)

Thanks again for the bug, keep them coming!

-----

1 point by conanite 5074 days ago | link

Ouch!

'after works to cleanup after errors; but it's not implemented for jumping into continuations. This one is hurting, I haven't found a quick solution. Continuations are mean enough alone; in combination with 'protect I'm lost. More news later ... and thanks for the bug report!

then I ran Ant again - oh, the joy of compiled languages :)

-----