Continuation.st
changeset 10210 963dac304d35
parent 8913 b9498d27a554
child 10224 a63c1f284258
--- a/Continuation.st	Tue Nov 28 20:34:54 2006 +0100
+++ b/Continuation.st	Wed Nov 29 10:16:30 2006 +0100
@@ -9,7 +9,6 @@
  other person.  No title to or ownership of the software is
  hereby transferred.
 "
-
 "{ Package: 'stx:libbasic' }"
 
 Object subclass:#Continuation
@@ -40,7 +39,7 @@
 
 documentation
 "
-    Initial attempt - Uninished.
+    Initial attempt - Unfinished.
     Continuations do not work yet - there is more support needed in the VM.
 
     [Instance variables:]
@@ -68,26 +67,6 @@
 !Continuation class methodsFor:'instance creation'!
 
 current
-        ^ self new
-"/        ^ self fromContext: thisContext sender
-!
-
-currentDo: aBlock
-        ^ aBlock value:self new
-
-        "/ ^ aBlock value: (self fromContext: thisContext sender)
-!
-
-fromContext: aStack
-        aStack == thisContext sender ifFalse:[
-            self error.
-        ].
-        ^ self new
-
-"/        ^ self new initializeFromContext: aStack
-!
-
-new
     |cont id|
 
     cont := super new.
@@ -108,8 +87,22 @@
     ^ cont
 
     "
-     self new
+     self current
     "
+
+    "Modified: / 29-11-2006 / 10:12:35 / cg"
+!
+
+currentDo: aBlock
+    ^ aBlock value:self current
+
+    "Modified: / 29-11-2006 / 10:14:03 / cg"
+!
+
+new
+    self error:'continuations must be created with #current'
+
+    "Modified: / 29-11-2006 / 10:13:19 / cg"
 ! !
 
 !Continuation methodsFor:'invocation'!
@@ -151,20 +144,6 @@
 
 !Continuation methodsFor:'private'!
 
-initializeFromContext: aContext
-self halt.
-"/        | valueStream context |
-"/
-"/        valueStream _ WriteStream on: (Array new: 20).
-"/        context _ aContext.
-"/        [context notNil] whileTrue:
-"/                [valueStream nextPut: context.
-"/                1 to: context class instSize do: [:i | valueStream nextPut: (context instVarAt: i)].
-"/                1 to: context localSize do: [:i | valueStream nextPut: (context localAt: i)].
-"/                context _ context sender].
-"/        values _ valueStream contents
-!
-
 terminate: aContext
 self halt.
 "/        | context |
@@ -207,5 +186,5 @@
 !Continuation class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Continuation.st,v 1.11 2005-07-08 17:15:01 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Continuation.st,v 1.12 2006-11-29 09:16:30 cg Exp $'
 ! !