|
Class: Continuation
Object
|
+--Continuation
- Package:
- stx:libbasic
- Category:
- Kernel-Processes
- Version:
- rev:
1.20
date: 2024/02/09 11:16:16
- user: stefan
- file: Continuation.st directory: libbasic
- module: stx stc-classLibrary: libbasic
Initial attempt - Unfinished.
Continuations do not work yet - there is more support needed in the VM.
[Instance variables:]
id <SmallInteger> a unique continuation-id;
Used to identify a corresponding
data-structure in the VM.
process <Process> the process which created this continuation.
[Class variables:]
copyrightCOPYRIGHT (c) 2004 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
instance creation
-
current
-
this is called current-continuation in scheme
Usage example(s):
-
currentDo: aBlock
-
this is is called call/cc in scheme
-
new
-
(comment from inherited method)
return an instance of myself without indexed variables
invocation
-
argumentCount
-
VisualAge/ANSI compatibility
-
numArgs
-
use argumentCount
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
value
-
(comment from inherited method)
return the receiver itself.
This allows every object to be used where blocks or valueHolders
are typically used, and allows for valueHolders and blocks to be
used interchangably in some situations.
Time will show, if this is a good idea or leads to sloppy programming
style ... (the idea was borrowed from the Self language).
WARNING: don't 'optimize' away ifXXX: blocks
(i.e. do NOT replace
foo ifTrue:[var1] ifFalse:[var2]
by:
foo ifTrue:var1 ifFalse:var2
)
- the compilers will only generate inline code for the if,
iff the argument(s) are blocks - otherwise, a true send is
generated.
This 'optimization' will work semantically correct,
but execute SLOWER instead.
Using constants (foo ifTrue:1 ifFalse:2) does not introduce a performance penalty.
-
value: v
-
self terminate: thisContext.
-
valueWithArguments: v
-
private
-
terminate: aContext
-
| context |
private accessing
-
finalize
-
(comment from inherited method)
this is invoked for executor objects which have been registered
in a Registry, when the original object dies.
Subclasses may redefine this method
This interface is also VW-compatible
-
setId: idArg process: aProcess
-
restoration
-
restoreValues
-
| valueStream context |
|