0

I was playing around with RxScala and Subject in scala worksheet. But something weird happened. enter image description here

as we can see, subscription c also get numbers and output them. After that, I find subscription c is var not val. So, I change the declare. And get following enter image description here

This one is correct. So, I copy those code to a main function and run it. It is interesting that the output is same with the second picture whether c is val or not.

Why those happend? Program runing in worksheet is different from those after compiling even with the same code?

Nks Sai
  • 23
  • 2
  • I am using intelliJ in windows and Rxscala is 0.25.0 – Nks Sai Sep 17 '15 at 15:53
  • For compilation, intellij does some transformations to worksheets, like wrapping in an object and adding lazy to vals. I'm sure that is causing the differences here, but I can't pinpoint exactly what is happening. – emilianogc Sep 17 '15 at 18:22

0 Answers0