nimhcr_0_2.nim 544 B

12345678910111213141516171819
  1. import hotcodereloading
  2. import nimhcr_1 # new import!
  3. # global scope for this module was executed when loading the program
  4. # with a previous version which didn't contain this print statement
  5. echo " 0: I SHOULDN'T BE PRINTED!"
  6. var g_0 = 0 # changed value but won't take effect
  7. proc getInt*(): int = return g_0 + g_1 + f_1()
  8. beforeCodeReload:
  9. echo " 0: before - improved!" # changed handlers!
  10. afterCodeReload:
  11. echo " 0: after - improved!"
  12. g_0 = 100 # we cannot change it in its initialization but we can in the 'after' handler!