I'm brand-new to Nim, so this may be way off-base. If I have a package with ModuleA and submodule ModuleB, and an error occurs in the top-level statements initializing ModuleB, the error is not reported, and it seems to mess up subsequent error-handling in ModuleA.
Consider
# ModuleA
import Test/ModuleB
echo "ModuleA about to have exception"
echo high(int) + 1
If ModuleB is
# ModuleB
echo "First top-level statement of ModuleB"
echo high(int)
echo "ModuleB last statement"
this produces
nimtest>bin\test First top-level statement of ModuleB 9223372036854775807 ModuleB last statement ModuleA about to have exception d:\nimtest\src\Test.nim(3) Test C:\Program Files\nim-2.0.0\lib\system\fatal.nim(53) sysFatal Error: unhandled exception: over- or underflow [OverflowDefect] nimtest>
as expected. But if ModuleB is modified to cause an error:
# ModuleB
echo "First top-level statement of ModuleB"
echo high(int) + 1
echo "ModuleB last statement"
the result is:
nimtest>bin\test First top-level statement of ModuleB ModuleA about to have exceptionTraceback (most recent call last) d:\nimtest\src\Test.nim(3) Test C:\Program Files\nim-2.0.0\lib\system\fatal.nim sysFatal C:\Program Files\nim-2.0.0\lib\system\arc.nim(81) nimNewObj SIGSEGV: Illegal storage access. (Attempt to read from nil?) nimtest>
The error is not reported in ModuleB, but the statement after the error is not executed, and the subsequent error in ModuleA results in an illegal storage access.
I first noticed this, because assert failures in the submodule were not getting reported. Am I missing something here? If there's any complexity to the submodule's initialization code, this makes it harder to debug.
The issue for those interested (or Googling this in the future and who don't want to search through the GitHub issue tracker).
I was looking into this because I'm facing a SIGSEGV from popCurrentException in a long running program I've got. Super hard to reproduce as it only crashes about once every couple of days. But it's always popCurrentException which causes it. Still digging in to find out what's going on, maybe I'll be able to get something reproduced..
杨意不逢,抚凌云而自惜;钟期既遇,奏流水以何惭?
I kept being a half-assed loser and never stuck to something interesting longer than months. Thus, I'm grateful to find the Nim language, which I can pour my heart into, where I found dozens of passionate and great people among whom @araq and @timotheecour have helped me mostly and kept me away from boredom. Besides, I have to seize the day working hard on the Nim language and pray that one day I might become a professional programmer and do some magnificent work.
pray that one day I might [...] do some magnificent work.
That day is already here! Everybody who follows Nim's Github repo can confirm that.
I'll be free to speak in their names too, and say: Thanks for all the magnificent work so far and for all future stuff yet to come!