commentary
authorClaus Gittinger <cg@exept.de>
Mon, 20 Nov 1995 14:18:04 +0100
changeset 580 03852d320a48
parent 579 2d26193415b5
child 581 8a991a4cb738
commentary
QuerySig.st
QuerySignal.st
--- a/QuerySig.st	Mon Nov 20 14:15:04 1995 +0100
+++ b/QuerySig.st	Mon Nov 20 14:18:04 1995 +0100
@@ -34,7 +34,7 @@
 !
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Attic/QuerySig.st,v 1.3 1995-11-11 15:26:13 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Attic/QuerySig.st,v 1.4 1995-11-20 13:18:04 cg Exp $'
 !
 
 documentation
@@ -42,7 +42,43 @@
     QuerySignals are like signals, except that they are not accepted
     by handlers for ordinary signals.
     I.e. a signal handler for a normal signal will not handle a query
-    signal. Thus, these bypass any Object-ErrorSignal handler.
+    signal. Thus, these bypass anySignal handlers.
+    Also, using a QuerySignal helps in documenting the intended use of these signals.
+
+    They can be used to implement up-Queries via signals even if intermediate
+    errorSignal handlers are present (which is no possible with ordinary signals).
+"
+!
+
+examples 
+"
+    an up-query from a deeply nested operation to a higher level:
+
+	|querySignal zero|
+
+	zero := 0.
+	querySignal := QuerySignal new.
+	querySignal handle:[:ex |
+	    ex proceedWith:true
+	] do:[
+	    'nexting'.
+	    [
+		[
+		    Object errorSignal handle:[:ex |
+			ex proceed
+		    ] do:[
+			[
+			    1 // zero.  'a cought error'.
+			    (querySignal raise) ifTrue:[
+				Transcript showCr:'query says: ok'.
+			     ] ifFalse:[
+				Transcript showCr:'query says: no'
+			     ]
+			] value
+		    ]
+		] value
+	    ] value
+	]
 "
 ! !
 
--- a/QuerySignal.st	Mon Nov 20 14:15:04 1995 +0100
+++ b/QuerySignal.st	Mon Nov 20 14:18:04 1995 +0100
@@ -34,7 +34,7 @@
 !
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/QuerySignal.st,v 1.3 1995-11-11 15:26:13 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/QuerySignal.st,v 1.4 1995-11-20 13:18:04 cg Exp $'
 !
 
 documentation
@@ -42,7 +42,43 @@
     QuerySignals are like signals, except that they are not accepted
     by handlers for ordinary signals.
     I.e. a signal handler for a normal signal will not handle a query
-    signal. Thus, these bypass any Object-ErrorSignal handler.
+    signal. Thus, these bypass anySignal handlers.
+    Also, using a QuerySignal helps in documenting the intended use of these signals.
+
+    They can be used to implement up-Queries via signals even if intermediate
+    errorSignal handlers are present (which is no possible with ordinary signals).
+"
+!
+
+examples 
+"
+    an up-query from a deeply nested operation to a higher level:
+
+	|querySignal zero|
+
+	zero := 0.
+	querySignal := QuerySignal new.
+	querySignal handle:[:ex |
+	    ex proceedWith:true
+	] do:[
+	    'nexting'.
+	    [
+		[
+		    Object errorSignal handle:[:ex |
+			ex proceed
+		    ] do:[
+			[
+			    1 // zero.  'a cought error'.
+			    (querySignal raise) ifTrue:[
+				Transcript showCr:'query says: ok'.
+			     ] ifFalse:[
+				Transcript showCr:'query says: no'
+			     ]
+			] value
+		    ]
+		] value
+	    ] value
+	]
 "
 ! !