*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Tue, 22 Sep 2009 12:50:58 +0200
changeset 11998 842499b2f567
parent 11997 b4a8b0240492
child 11999 5c5947a4b464
*** empty log message ***
Block.st
--- a/Block.st	Tue Sep 22 11:08:34 2009 +0200
+++ b/Block.st	Tue Sep 22 12:50:58 2009 +0200
@@ -798,6 +798,49 @@
     ^ self wrongNumberOfArguments:1
 !
 
+value:arg1 optionalArgument:arg2
+    "evaluate the receiver.
+     Optionally pass up one or to two arguments (if the receiver is a one/two arg block)."
+
+    nargs == 2 ifTrue:[
+        ^ self value:arg1 value:arg2
+    ].
+    ^ self value:arg1
+
+    "
+     |block|
+
+     block := [:arg | Transcript showCR:arg ].
+     block value:2 optionalArgument:3.     
+
+     block := [:arg1 :arg2 | Transcript show:arg1; space; showCR:arg2 ].
+     block value:2 optionalArgument:3.     
+    "
+!
+
+value:arg1 optionalArgument:arg2 and:arg3
+    "evaluate the receiver.
+     Optionally pass up one, two or three arguments (if the receiver is a 1/2/3-arg block)."
+
+    nargs == 3 ifTrue:[
+        ^ self value:arg1 value:arg2 value:arg3
+    ].
+    nargs == 2 ifTrue:[
+        ^ self value:arg1 value:arg2
+    ].
+    ^ self value:arg1
+
+    "
+     |block|
+
+     block := [:arg | Transcript showCR:arg ].
+     block value:2 optionalArgument:3.     
+
+     block := [:arg1 :arg2 | Transcript show:arg1; space; showCR:arg2 ].
+     block value:2 optionalArgument:3.     
+    "
+!
+
 value:arg1 value:arg2
     "evaluate the receiver with two arguments. 
      The receiver must be a 2-arg block."
@@ -838,6 +881,16 @@
     ^ self wrongNumberOfArguments:2
 !
 
+value:arg1 value:arg2 optionalArgument:arg3
+    "evaluate the receiver.
+     Optionally pass two or threearguments (if the receiver is a 2/3-arg block)."
+
+    nargs == 3 ifTrue:[
+        ^ self value:arg1 value:arg2 value:arg3
+    ].
+    ^ self value:arg1 value:arg2
+!
+
 value:arg1 value:arg2 value:arg3
     "evaluate the receiver with three arguments. 
      The receiver must be a 3-arg block."
@@ -1240,7 +1293,8 @@
 
 valueAt:priority
     "evaluate the receiver, at the given prioriy;
-     i.e. change the priority for the execution of the receiver."
+     i.e. change the priority for the execution of the receiver.
+     Bad name: should be called evaluateWithPriority: or similar"
 
     |oldPrio retVal activeProcess|
 
@@ -2830,7 +2884,7 @@
 !Block class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Block.st,v 1.170 2009-09-16 19:22:34 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Block.st,v 1.171 2009-09-22 10:50:58 cg Exp $'
 ! !
 
 Block initialize!