--- a/Block.st Sat Apr 01 15:02:35 2000 +0200
+++ b/Block.st Sat Apr 01 15:04:33 2000 +0200
@@ -10,6 +10,8 @@
hereby transferred.
"
+"{ Package: 'stx:libbasic' }"
+
CompiledCode variableSubclass:#Block
instanceVariableNames:'home nargs sourcePos initialPC'
classVariableNames:'InvalidNewSignal'
@@ -360,6 +362,41 @@
"Modified: 23.4.1996 / 15:55:58 / cg"
! !
+!Block methodsFor:'Compatibility - ANSI'!
+
+ensure:aBlock
+ "evaluate the receiver and return its result.
+ After evaluation, also evaluate aBlock but ignore its result.
+ aBlock is also evaluated in case of abnormal termination.
+ (the same as #valueNowOrOnUnwindDo:)"
+
+ ^ self valueNowOrOnUnwindDo:aBlock
+
+ "
+ [
+ [
+ Transcript showCR:'one'.
+ Processor activeProcess terminate.
+ Transcript showCR:'two'.
+ ] ensure:[
+ Transcript showCR:'three'.
+ ].
+ ] fork.
+ "
+
+ "
+ [
+ [
+ Transcript showCR:'one'.
+ Transcript showCR:'two'.
+ ] ensure:[
+ Transcript showCR:'three'.
+ ].
+ ] fork.
+ "
+
+! !
+
!Block methodsFor:'Compatibility - Squeak'!
ifError:handlerBlock
@@ -441,7 +478,7 @@
!Block methodsFor:'conversion'!
-beVarArg
+asVarArgBlock
"convert myself into a varArg block;
this one has 1 formal argument, which gets the list
of actual arguments when evaluated."
@@ -457,6 +494,29 @@
"
|b|
+ b := [:argList | Transcript
+ show:'invoked with args:';
+ showCR:argList
+ ] asVarArgBlock.
+ b value.
+ b value:'arg1'.
+ b value:'arg1' value:'arg2' value:'arg3' value:'arg4'
+ "
+
+ "Created: 23.1.1997 / 13:35:28 / cg"
+ "Modified: 23.1.1997 / 13:35:48 / cg"
+!
+
+beVarArg
+ "convert myself into a varArg block;
+ this one has 1 formal argument, which gets the list
+ of actual arguments when evaluated."
+
+ ^ self asVarArgBlock.
+
+ "
+ |b|
+
b := [:argList | argList printCR] beVarArg.
b value.
b value:'arg1' value:'arg2' value:'arg3' value:'arg4'
@@ -1544,39 +1604,6 @@
!Block methodsFor:'unwinding'!
-ensure:aBlock
- "evaluate the receiver and return its result.
- After evaluation, also evaluate aBlock but ignore its result.
- aBlock is also evaluated in case of abnormal termination.
- (the same as #valueNowOrOnUnwindDo:)"
-
- ^ self valueNowOrOnUnwindDo:aBlock
-
- "
- [
- [
- Transcript showCR:'one'.
- Processor activeProcess terminate.
- Transcript showCR:'two'.
- ] ensure:[
- Transcript showCR:'three'.
- ].
- ] fork.
- "
-
- "
- [
- [
- Transcript showCR:'one'.
- Transcript showCR:'two'.
- ] ensure:[
- Transcript showCR:'three'.
- ].
- ] fork.
- "
-
-!
-
unwindHandlerInContext:aContext
"given a context which has been marked for unwind,
retrieve the handler block.
@@ -1718,6 +1745,6 @@
!Block class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Block.st,v 1.95 2000-01-27 12:02:31 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Block.st,v 1.96 2000-04-01 13:04:33 cg Exp $'
! !
Block initialize!