The root proto. All other protos clone from Object; it provides core slot management, message dispatch, introspection, and control flow primitives.
The '' method evaluates the argument and returns the result.
Returns true the receiver is not equal to aValue, false otherwise.
Returns the negative version of aNumber. Raises an exception if argument is not a number.
.. is an alias for: method(arg, self asString append(arg asString))
Evaluates argument and returns self if self is less or Nil if not.
Evaluates argument and returns self if self is less than or equal to it, or Nil if not.
Returns true if receiver and aValue are equal, false otherwise.
Evaluates argument and returns self if self is greater than it, or Nil if not.
Evaluates argument and returns self if self is greater than or equal to it, or Nil if not.
description: Sends the message aMessage to the receiver if it can respond to it. Example:
MyObject test // performs test MyObject ?test // performs test if MyObject has a slot named testThe search for the slot only follows the receivers proto chain.
Sends asynchronous message to an object, returns a FutureProxy.
Caller coroutine is paused when proxy is accessed (i.e. message is sent)
till result is ready. Proxy will become an actual result when it is ready.
See IoGuide for more information.
Usage: obj @someMethod(a, b, c)
Same as Object @, but returns nil instead of FutureProxy.
Might be useful in a command line or as a last expression in a block/method when
you don't want to return a future.
Processes each message in a queue, yielding between each message.
Starts actor mode if not started already. Basically, sets actorProcessQueue for later execution.
Takes another object, whose slots will be copied into the receiver. Optionally takes a second argument, a Map object containing string -> string pairs, holding conflicting slot names and names to rename them to. I.e., if you have two objects A and B, both have a slot named foo, you issue A addTrait(B, Map clone atPut("foo", "newFoo")) the value of B foo will be placed in A newFoo.
Returns the first ancestor of the receiver that contains a slot of the specified name or Nil if none is found.
Returns a list of all of the receiver's ancestors as found by recursively following the protos links.
Evaluates argument and returns the result.
Appends anObject to the receiver's proto list. Returns self.
Prints out Protos Core slot descriptions.
Note: seems to be an obsolete method.
Returns true if arg is an activation context (i.e. Call object)
Note: this is used internally in one place only (Coroutine callStack).
Refactoring should be considered.
Returns
Same as slotSummary.
Replaces receiver with anotherObject and returns self.
Useful for implementing transparent proxies. See also
FutureProxy and Object @.
Note: primitives cannot
become new values.
Creates a block and binds it to the sender context (i.e. lexical
context). In other words, block locals' proto is sender's locals.
args is a list of formal arguments (can be empty).
body is evaluated in the context of Locals object.
See also Object method.
Io> block(x, x*2) scope == thisContext
==> true
Break the current loop, if any.
Calls aBlock with the current continuation as its argument. The continuation captures the execution state at the point of the callcc call. If the block returns normally, callcc returns the block's return value. If the continuation is invoked with a value, callcc returns that value instead.
Example: result := callcc(block(cont, // This is the "escape" pattern if(someCondition, cont invoke("early exit") ) "normal return" )) // result is either "early exit" or "normal return"
Accesses memory in the IoObjectData struct that should be accessible. Should cause a memory access exception if memory is corrupt.
Returns a clone of the receiver.
Returns a clone of the receiver but does not call init.
Compact the memory for the object if possible. Returns self.
Attempt to compact the memory of the IoState if possible.
Returns a number containing the comparison value of the target with anObject.
Returns the first context (starting with the receiver and following the lookup path) that contains a slot of the specified name or Nil if none is found.
Skip the rest of the current loop iteration and start on the next, if any.
Creates a new coro to be run in a context of sender and yields to it. Returns a coro.
Returns a new coro to be run in a context of sender.
New coro is moved to the top of the yieldingCoros queue to be executed
when current coro yields.
Note: run target is self (i.e. receiver), not call sender as in coroDo.
Returns a new coro to be run in a context of sender.
Returns a new coro to be run in a context of receiver.
Returns the currently running coroutine.
Prints a warning message that the current method is deprecated. If optionalNewName is supplied, the warning will suggest using that instead. Returns self.
Evaluates the message in the context of the receiver. Returns self.
Evaluates the File in the context of the receiver. Returns the result. pathString is relative to the current working directory.
Evaluates the message object in the context of the receiver. Returns the result. optionalContext can be used to specific the locals context in which the message is evaluated.
Evaluates the File in the context of the receiver. Returns the result. pathString is relative to the file calling doRelativeFile. (Duplicate of relativeDoFile)
Evaluates the string in the context of the receiver. Returns the result.
The '' method evaluates the argument and returns the result.
Evaluates the argument and returns nil.
Evaluates the argument and returns the target.
A for-loop control structure. See the io Programming Guide for a full description.
For each slot, set name to the slot's name and value to the slot's value and execute message. Examples:
myObject foreach(n, v,
writeln("slot ", n, " = ", v type)
)myObject foreach(v,
writeln("slot type ", v type)
)
Iterates over all the slots in a receiver. Provides slotValue (non-activated)
along with slotName. Code is executed in context of sender. slotName and slotValue
become visible in the receiver (no Locals created! Maybe, it is not the best decision).
Io> thisContext foreachSlot(n, v, n println) Lobby Protos exit forward n v ==> false
Called when the receiver is sent a message it doesn't recognize. Default implementation raises an "Object doesNotRespond" exception. Subclasses can override this method to implement proxies or special error handling.
Example:
myProxy forward = method( messageName := thisMessage name arguments := thisMessage arguments myObject doMessage(thisMessage) )
Returns the value of the slot named slotNameString (not looking in the object's protos) or nil if no such slot is found.
Returns the value of the slot named slotNameString (following the lookup path) or nil if no such slot is found.
Callback for handling exceptions during asynchronous message processing.
Default value: method(e, e showStack)
Returns true if the slot exists in the receiver or false otherwise.
Returns true if anObject is found in the proto path of the target, false otherwise.
Returns true if slot is found somewhere in the inheritance chain (including receiver itself).
Evaluates trueMessage if condition evaluates to a non-Nil. Otherwise evaluates optionalFalseMessage if it is present. Returns the result of the evaluated message or Nil if none was evaluated.
Does nothing, returns self.
Does nothing, returns self.
Does nothing, returns self.
Evaluates argument and returns self.
Evaluates argument and returns the result.
Same as: aList contains(self)
Creates a method which is executed directly in a receiver (no Locals object is created).
Io> m := inlineMethod(x := x*2) Io> x := 1 ==> 1 Io> m ==> 2 Io> m ==> 4 Io> m ==> 8
Returns true if the receiver is activatable, false otherwise.
Returns false if not an error.
Returns true if the receiver is identical to aValue, false otherwise.
Returns true if anObject is in the receiver's ancestors.
Returns true if the current file was run on the command line. Io's version of Python's __file__ == "__main__"
Returns false.
Returns true.
Writes serialized representation to a SerializationStream. Returns stream contents. [This is unintended side effect! Returned value may change in the future.]
Eval file at pathString as if from the command line in its folder.
Defines a slot with a lazy initialization code.
Code is run only once: the first time slot is accessed.
Returned value is stored in a regular slot.
Io> x := lazySlot("Evaluated!" println; 17)
Io> x
Evaluated!
==> 17
Io> x
==> 17
Io> x
==> 17
Io> lazySlot("x", "Evaluated!" println; 17)
Io> x
Evaluated!
==> 17
Io> x
==> 17
Io> x
==> 17
Evaluates the message in the context of the receiver. The lexical context is added as a proto of the receiver while the argument is evaluated. Returns self.
Returns a List containing the arguments.
CFunction used by Locals prototype for forwarding.
Local's version of updateSlot mthod.
Keeps evaluating message until a break.
Cleans object's slots.
Return the amount of memory used by the object.
Returns the number of bytes in the IoState (this may not include memory allocated by C libraries).
Return the message object for the argument or Nil if there is no argument. Note: returned object is a mutable singleton. Use "message(foo) clone" if you wish to modify it.
Creates a method.
args is a list of formal arguments (can be empty).
body is evaluated in the context of Locals object.
Locals' proto is a message receiver (i.e. self).
Slot with a method is activatable. Use getSlot(name) to
retrieve method object without activating it (i.e. calling).
See
also Object block.
Creates a getter and setter for the slot with the name slotName and sets its default value to aValue. Returns self. For example, newSlot("foo", 1) would create slot named foo with the value 1 as well as a setter method setFoo().
Returns nil.
Returns true.
A debug method.
Removes current coroutine from the yieldingCoros queue and
yields to another coro. Exits if no coros left.
See Coroutine documentation for more details.
Performs the method corresponding to methodName with the arguments supplied.
Performs the method corresponding to methodName with the arguments in the argList.
Prepends anObject to the receiver's proto list. Returns self.
Prints a string representation of the object. Returns Nil.
Same as print, but also prints a new line. Returns self.
Same as; method(self protos first)
Returns a copy of the receiver's protos list.
Does nothing, returns self.
Evaluates the File in the context of the receiver. Returns the result. pathString is relative to the file calling doRelativeFile. (Duplicate of doRelativeFile)
Removes all of the receiver's protos. Returns self.
Removes all of the receiver's slots. Returns self.
Removes anObject from the receiver's proto list if it is present. Returns self.
Removes the specified slot (only) in the receiver if it exists. Returns self.
Send the message used to activate the current method to the Object's proto. For example:
Dog := Mammal clone do(
init := method(
resend
)
)
Calling Dog init will send an init method to Mammal, but using the Dog's context.Return anObject from the current execution block.
Does nothing, returns self.
Returns the receiver from the current execution block if it is non nil. Otherwise returns the receiver locally.
Returns self.
Returns a serialized representation of the receiver.
Io> Object clone do(x:=1) serialized ==> Object clone do( x := 1 )
Writes all slots to a stream.
Writes selected slots to a stream.
When called with a non-Nil aValue, sets the object to call its activate slot when accessed as a value. Turns this behavior off if aValue is Nil. Only works on Objects which are not Activatable Primitives (such as CFunction or Block). Returns self.
Sets the first proto of the receiver to anObject, replacing the current one, if any. Returns self.
Replaces the receiver's protos with a copy of aList. Returns self.
Sets the slot slotNameString in the receiver to hold valueObject. Returns valueObject.
Sets the slot slotNameString in the receiver to hold valueObject and sets the type slot of valueObject to be slotNameString. Returns valueObject.
Returns a shallow copy of the receiver.
Returns raw map of slot names and short values' descriptions. See also Object slotSummary.
Returns a list of strings containing the names of the slots in the receiver (but not in its lookup path).
Returns a formatted slotDescriptionMap.
Io> slotSummary
==> Object_0x30c590:
Lobby = Object_0x30c590
Protos = Object_0x30c880
exit = method(...)
forward = method(...)
Returns a list of the values held in the slots of the receiver.
Returns the internal IoState->stopStatus.
Sends the message aMessage to the receiver's proto with the context of self. Example:
self test(1, 2) // performs test(1, 2) on self super(test(1, 2)) // performs test(1, 2) on self proto but with the context of self
Execute an expression depending on the value of the caller. (This is an equivalent to C switch/case)
hour := Date hour switch(
12, "midday",
0, "midnight",
17, "teatime",
Date hour asString
)
Synonym to self.
Returns current locals.
Returns the calling message (i.e. thisMessage itself, huh).
Executes particular code in a new coroutine.
Returns exception or nil if no exception is caught.
See also documentation for Exception catch and pass.
Returns a string containing the name of the type of Object (Number, String, etc).
Returns uniqueId in a hexadecimal form (with a "0x" prefix)
Io> Object uniqueId ==> 3146784 Io> Object uniqueHexId ==> 0x300420
Returns a Number containing a unique id for the receiver.
Same as setSlot(), but raises an error if the slot does not already exist in the receiver's slot lookup path.
Pauses current coroutine for at least s seconds.
Note: current coroutine may wait much longer than designated number of seconds
depending on circumstances.
Keeps evaluating message until condition return Nil. Returns the result of the last message evaluated or Nil if none were evaluated.
Installs a resumable exception handler for exceptions matching exceptionProto, runs body, then removes the handler. The handlerBlock receives (exception, resume). To resume at the signal site, call resume invoke(value) or simply return a value.
Sends a print message to the evaluated result of each argument. Returns Nil.
Same as write() but also writes a return character at the end. Returns Nil.
Yields to another coroutine. Does nothing if yieldingCoros queue is empty.
See Coroutine documentation for more details.