--- a/Block.st Tue Jul 20 18:40:26 1999 +0200
+++ b/Block.st Tue Jul 20 18:41:09 1999 +0200
@@ -511,53 +511,6 @@
!Block methodsFor:'evaluation'!
-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:)"
-
- |v|
-
-"/ #ensure could be implemented as:
-"/
-"/ [
-"/ v := self value.
-"/ ] valueNowOrOnUnwindDo:aBlock.
-"/ ^ v
-"/
-"/ however, we save one block creation, by doing it as:
-"/
- thisContext markForUnwind.
- v := self value. "the real logic is in Context>>unwind"
- thisContext unmarkForUnwind.
- aBlock value.
- ^ v
-
- "
- [
- [
- 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.
- "
-
-!
-
value
"evaluate the receiver with no block args.
The receiver must be a block without arguments."
@@ -1493,6 +1446,53 @@
!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:)"
+
+ |v|
+
+"/ #ensure could be implemented as:
+"/
+"/ [
+"/ v := self value.
+"/ ] valueNowOrOnUnwindDo:aBlock.
+"/ ^ v
+"/
+"/ however, we save one block creation, by doing it as:
+"/
+ thisContext markForUnwind.
+ v := self value. "the real logic is in Context>>unwind"
+ thisContext unmarkForUnwind.
+ aBlock value.
+ ^ v
+
+ "
+ [
+ [
+ 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.
+ "
+
+!
+
valueNowOrOnUnwindDo:aBlock
"evaluate the receiver - after that, or when some method sent within unwinds (i.e. does
a long return), evaluate the argument, aBlock.
@@ -1546,6 +1546,6 @@
!Block class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Block.st,v 1.83 1999-07-20 16:40:26 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Block.st,v 1.84 1999-07-20 16:41:09 cg Exp $'
! !
Block initialize!