summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xlib/system.nim13
-rwxr-xr-xlib/system/excpt.nim6
-rwxr-xr-xtodo.txt8
-rwxr-xr-xweb/news.txt3
4 files changed, 22 insertions, 8 deletions
diff --git a/lib/system.nim b/lib/system.nim
index 7a7a1c33b..1aa2732c1 100755
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -1447,11 +1447,20 @@ var
     ## set this variable to provide a procedure that should be called before
     ## each executed instruction. This should only be used by debuggers!
     ## Only code compiled with the ``debugger:on`` switch calls this hook.
-  raiseHook*: proc (e: ref E_Base): bool
+  globalRaiseHook*: proc (e: ref E_Base): bool
     ## with this hook you can influence exception handling on a global level.
     ## If not nil, every 'raise' statement ends up calling this hook. Ordinary
     ## application code should never set this hook! You better know what you
-    ## do when setting this. If ``raiseHook`` returns false, the exception
+    ## do when setting this. If ``globalRaiseHook`` returns false, the
+    ## exception is caught and does not propagate further through the call
+    ## stack.
+
+  localRaiseHook* {.threadvar.}: proc (e: ref E_Base): bool
+    ## with this hook you can influence exception handling on a
+    ## thread local level.
+    ## If not nil, every 'raise' statement ends up calling this hook. Ordinary
+    ## application code should never set this hook! You better know what you
+    ## do when setting this. If ``localRaiseHook`` returns false, the exception
     ## is caught and does not propagate further through the call stack.
     
   outOfMemHook*: proc
diff --git a/lib/system/excpt.nim b/lib/system/excpt.nim
index 2da768810..9593e3ebc 100755
--- a/lib/system/excpt.nim
+++ b/lib/system/excpt.nim
@@ -194,8 +194,10 @@ proc quitOrDebug() {.inline.} =
 
 proc raiseException(e: ref E_Base, ename: CString) {.compilerRtl.} =
   e.name = ename
-  if raiseHook != nil:
-    if not raiseHook(e): return
+  if localRaiseHook != nil:
+    if not localRaiseHook(e): return
+  if globalRaiseHook != nil:
+    if not globalRaiseHook(e): return
   if excHandler != nil:
     pushCurrentException(e)
     c_longjmp(excHandler.context, 1)
diff --git a/todo.txt b/todo.txt
index 4db53a105..ea7b4356d 100755
--- a/todo.txt
+++ b/todo.txt
@@ -6,11 +6,7 @@ Version 0.8.14
 - fix actors.nim
 - make threadvar efficient again on linux after testing
 - test the sort implementation again
-- optional indentation for 'case' statement
 - document & test splicing; don't forget to test negative indexes
-- thread local vs. global raiseHook()
-- make pegs support a compile-time option and make c2nim use regexes instead
-  per default
 - implement lib/pure/memfiles properly
 
 incremental compilation
@@ -32,6 +28,7 @@ version 0.9.0
 
 - const ptr/ref
 - unsigned ints and bignums
+- implement the high level optimizer
 - warning for implicit openArray -> varargs convention
 - implement explicit varargs
 - tests: run the GC tests
@@ -43,6 +40,7 @@ version 0.9.0
 - os module should use Windows Unicode versions
 - 64bit build for Windows
 - codegen should use "NIM_CAST" macro and respect aliasing rules for GCC
+- optional indentation for 'case' statement
 
 Bugs
 ----
@@ -74,6 +72,8 @@ version 0.9.XX
 - 'nimrod def': does not always work?
 - test branch coverage
 - checked exceptions
+- make pegs support a compile-time option and make c2nim use regexes instead
+  per default?
 - fix implicit generic routines
 - think about ``{:}.toTable[int, string]()``
 - mocking support with ``tyProxy`` that does:
diff --git a/web/news.txt b/web/news.txt
index b415b9164..a26f72263 100755
--- a/web/news.txt
+++ b/web/news.txt
@@ -39,6 +39,9 @@ Changes affecting backwards compatibility
 - The threading API has been completely redesigned.
 - The ``unidecode`` module is now thread-safe and its interface has changed.
 - The ``bind`` expression is deprecated, use a ``bind`` declaration instead.
+- ``system.raiseHook`` is now split into ``system.localRaiseHook`` and
+  ``system.globalRaiseHook`` to distinguish between thread local and global
+  raise hooks.
 
 
 Language Additions