Base is the top of the inheritance structure. Most of the objects in the system are derived from this instance. Base should keep its cells to the bare minimum needed for the system.

Mimics
Inactive cells
Active cells
Specs
Inactive cells (details)
inspect = "Base"
kind = "Base"
notice = "Base"
Active cells (details)
=([place], value, +[morePlacesForDestructuring])

expects two or more arguments, the first arguments unevaluated, the last evaluated. assigns the result of evaluating the last argument in the context of the caller, and assigns this result to the name/s provided by the first arguments. the first arguments remains unevaluated. the result of the assignment is the value assigned to the name. if the last argument is a method-like object and it's name is not set, that name will be set to the name of the cell.

==(other)

returns true if the left hand side is equal to the right hand side. exactly what this means depend on the object. the default behavior of Ioke objects is to only be equal if they are the same instance.

cell(cellName)

expects one evaluated text or symbol argument and returns the cell that matches that name, without activating even if it's activatable.

Base cell
  • - should be possible to get a cell using a Text argument [ show source ]
    x = 42 
    cell("x") should ==(x) 
    Text x = 42 
    Text cell("x") should ==(Text x) 
    
    
  • - should be possible to get a cell using a Symbol argument [ show source ]
    x = 42 
    cell(:x) should ==(x) 
    Text x = 42 
    Text cell(:x) should ==(Text x) 
    
    
  • - should be possible to get a cell with an empty name [ show source ]
    cell(:("")) kind should ==("DefaultMethod") 
    
    
  • - should report an error if trying to get a cell that doesn't exist in that object [ show source ]
    fn(cell(:clurg)) should signal(Condition Error NoSuchCell) 
    fn(cell("clurg")) should signal(Condition Error NoSuchCell) 
    
    
cell=(cellName, value)

expects one evaluated text or symbol argument that names the cell to set, sets this cell to the result of evaluating the second argument, and returns the value set.

Base cell=
  • - should be possible to set a cell using a Text argument [ show source ]
    cell("blurg") = 42 
    blurg should ==(42) 
    Text cell("murg") = 42 
    Text murg should ==(42) 
    
    
  • - should be possible to set a cell using a Symbol argument [ show source ]
    cell(:blurg) = 42 
    blurg should ==(42) 
    Text cell(:murg) = 42 
    Text murg should ==(42) 
    
    
  • - should be possible to set a cell with an empty name [ show source ]
    oldEmpty = cell("") 
    Text cell("") = 42 
    Text cell("") should ==(42) 
    Text cell("") = cell(:oldEmpty) 
    
    
  • - should be possible to set a cell with complicated expressions [ show source ]
    f = Origin mimic 
    f b = "foobar" 
    Text cell(f b) = 42 +(24) -(3) 
    Text cell(:foobar) should ==(63) 
    
    
  • - should be possible to set a cell that doesn't exist [ show source ]
    cell(:blurg) = 42 
    blurg should ==(42) 
    Text cell(:murg) = 42 
    Text murg should ==(42) 
    
    
  • - should be possible to set a cell that does exist [ show source ]
    Ground x = 42 
    cell(:x) = 43 
    x should ==(43) 
    
    
  • - should be possible to set a cell that does exist in a mimic. this should not change the mimic value [ show source ]
    one = Origin mimic 
    one x = 42 
    two = one mimic 
    two cell(:x) = 43 
    one x should ==(42) 
    one = Origin mimic 
    one x = 42 
    two = one mimic 
    two cell(:x) = 43 
    two x should ==(43) 
    
    
cell?(cellName)

expects one evaluated text or symbol argument and returns a boolean indicating whether such a cell is reachable from this point.

Base cell?
  • - should be possible to check for the existance of a cell using a text argument [ show source ]
    x = 42 
    cell?("x") should be true 
    
    
  • - should be possible to check for the existance of a cell using a symbol argument [ show source ]
    x = 42 
    cell?(:x) should be true 
    
    
  • - should be possible to check for the existance of a cell with an empty name [ show source ]
    cell?("") should be true 
    
    
  • - should be possible to check for the existance of a cell that doesn't exist [ show source ]
    cell?(:murg) should be false 
    
    
  • - should be possible to check for the existance of a cell that does exist [ show source ]
    cell?(:Ground) should be true 
    
    
cellNames(includeMimics false, cutoff nil)

takes one optional evaluated boolean argument, which defaults to false. if false, this method returns a list of the cell names of the receiver. if true, it returns the cell names of this object and all it's mimics recursively.

Base cellNames
  • - should return the cell names of this object by default [ show source ]
    x = Origin mimic 
    x cellNames should ==([]) 
    x f = 13 
    x cellNames should ==([](:f)) 
    x Why = 1 
    x cellNames should ==([](:f, :Why)) 
    x = Origin mimic 
    x Why = 1 
    x f = 13 
    x cellNames should ==([](:Why, :f)) 
    
    
  • - should take a boolean, when given will make it return all cell names in both this and it's parents objects [ show source ]
    baseNames = Base cells keys asList sort 
    defaultBehaviorNames = DefaultBehavior cells keys sort 
    defaultBehaviorAllNames = DefaultBehavior cells(true) keys sort 
    iokeGroundNames = IokeGround cells keys sort 
    groundNames = Ground cells keys sort 
    originNames = Origin cells keys sort 
    
    nativeGroundAllNames = if(System feature?(:java), JavaGround cells keys sort, []) 
    groundAllNames = set(*(iokeGroundNames +(groundNames) +(nativeGroundAllNames) +(baseNames) +(defaultBehaviorAllNames))) sort 
    originAllNames = set(*(originNames +(groundAllNames) +(nativeGroundAllNames))) sort 
    Base cellNames sort should ==(baseNames) 
    Base cellNames(false) sort should ==(baseNames) 
    Base cellNames(true) sort should ==(baseNames) 
    DefaultBehavior cellNames sort should ==(defaultBehaviorNames) 
    DefaultBehavior cellNames(false) sort should ==(defaultBehaviorNames) 
    DefaultBehavior cellNames(true) sort should ==(defaultBehaviorAllNames) 
    Ground cellNames sort should ==(groundNames) 
    Ground cellNames(false) sort should ==(groundNames) 
    Ground cellNames(true) sort should ==(groundAllNames) 
    Origin cellNames sort should ==(originNames) 
    Origin cellNames(false) sort should ==(originNames) 
    Origin cellNames(true) sort should ==(originAllNames) 
    Text x = Origin mimic 
    Text x cellNames(true) sort should ==(originAllNames) 
    Text x = Origin mimic 
    Text x foxy_base_spec = 12 
    Text x cellNames(true) sort should ==(([](:foxy_base_spec) +(originAllNames)) sort) 
    
    
cellOwner(cellName)

expects one evaluated text or symbol argument and returns the closest object that defines such a cell. if it doesn't exist, a NoSuchCell condition will be signalled.

Base cellOwner
  • - should return the closest owner of a cell [ show source ]
    x = Origin mimic 
    y = x mimic 
    x foo = 123 
    y foo = "bar" 
    x cellOwner(:foo) should be same(x) 
    y cellOwner(:foo) should be same(y) 
    x mimic cellOwner(:foo) should be same(x) 
    
    
  • - should signal a condition if there is no such cell [ show source ]
    fn(Origin cellOwner(:test_cell_owner)) should signal(Condition Error NoSuchCell) 
    
    
  • - should offer an ignore restart if the cell can't be found [ show source ]
    fn(Origin cellOwner(:test_cell_owner)) should offer(restart(ignore, fn)) 
    fn(Origin cellOwner(:test_cell_owner)) should returnFromRestart(:ignore) ==(nil) 
    
    
cellOwner?(cellName)

expects one evaluated text or symbol argument and returns a boolean indicating whether this cell is owned by the receiver or not. the assumption is that the cell should exist. if it doesn't exist, a NoSuchCell condition will be signalled.

Base cellOwner?
  • - should return true if the cell name is owned by this object [ show source ]
    x = Origin mimic 
    y = x mimic 
    x foo = 123 
    y foo = "bar" 
    x cellOwner?(:foo) should be true 
    y cellOwner?(:foo) should be true 
    
    
  • - should return false if the cell name is owned by another object [ show source ]
    x = Origin mimic 
    y = x mimic 
    x foo = 123 
    y cellOwner?(:foo) should be false 
    
    
  • - should signal a condition if there is no such cell [ show source ]
    fn(Origin cellOwner?(:test_cell_owner)) should signal(Condition Error NoSuchCell) 
    
    
  • - should offer an ignore restart if the cell can't be found [ show source ]
    fn(Origin cellOwner?(:test_cell_owner)) should offer(restart(ignore, fn)) 
    fn(Origin cellOwner?(:test_cell_owner)) should returnFromRestart(:ignore) ==(false) 
    
    
cells(includeMimics false)

takes one optional evaluated boolean argument, which defaults to false. if false, this method returns a dict of the cell names and values of the receiver. if true, it returns the cell names and values of this object and all it's mimics recursively.

Base cells
  • - should return the cells of this object by default [ show source ]
    x = Origin mimic 
    x cells should ==({}) 
    x = Origin mimic 
    x f = 13 
    x cells should ==({}(f: 13)) 
    x = Origin mimic 
    x f = 13 
    x Why = 1 
    x cells should ==({}(f: 13, Why: 1)) 
    x = Origin mimic 
    x Why = 1 
    x f = 13 
    x cells should ==({}(f: 13, Why: 1)) 
    
    
  • - should take a boolean, when given will make it return all cells in both this and it's parents objects [ show source ]
    x = Base mimic 
    x cells(true) should ==({}(
        kind: Base cell(:kind), 
        mimic: Base cell(:mimic), 
        :("=") =>(Base cell(:("="))), 
        :("==") =>(Base cell(:("=="))), 
        hash: Base cell(:hash), 
        documentation: Base cell(:documentation), 
        :("documentation=") =>(Base cell(:("documentation="))), 
        cell: Base cell(:cell), 
        identity: Base cell(:identity), 
        cellNames: Base cell(:cellNames), 
        cells: Base cell(:cells), 
        :("cell=") =>(Base cell(:("cell="))), 
        notice: "Base", 
        inspect: "Base", 
        :("removeCell!") =>(Base cell(:("removeCell!"))), 
        :("undefineCell!") =>(Base cell(:("undefineCell!"))), 
        :("cellOwner?") =>(Base cell(:("cellOwner?"))), 
        :("cellOwner") =>(Base cell(:("cellOwner"))), 
        :("cell?") =>(Base cell("cell?")))) 
    x = Base mimic 
    x kind = "blarg" 
    x cells(true) should ==({}(
        kind: "blarg", 
        mimic: Base cell(:mimic), 
        :("=") =>(Base cell(:("="))), 
        :("==") =>(Base cell(:("=="))), 
        hash: Base cell(:hash), 
        documentation: Base cell(:documentation), 
        :("documentation=") =>(Base cell(:("documentation="))), 
        cell: Base cell(:cell), 
        identity: Base cell(:identity), 
        cellNames: Base cell(:cellNames), 
        cells: Base cell(:cells), 
        :("cell=") =>(Base cell(:("cell="))), 
        notice: "Base", 
        inspect: "Base", 
        :("removeCell!") =>(Base cell(:("removeCell!"))), 
        :("undefineCell!") =>(Base cell(:("undefineCell!"))), 
        :("cellOwner?") =>(Base cell(:("cellOwner?"))), 
        :("cellOwner") =>(Base cell(:("cellOwner"))), 
        :("cell?") =>(Base cell("cell?")))) 
    
    
documentation()

returns the documentation text of the object called on. anything can have a documentation text - this text will initially be nil.

Base documentation
  • - should return nil for a new object [ show source ]
    Origin mimic documentation should be nil 
    
    
  • - should return the documentation string for an object that has documentation [ show source ]
    Origin documentation should ==("Any object created from scratch should usually be derived from Origin.") 
    
    
documentation=(text)

sets the documentation string for a specific object.

Base documentation=
  • - should set the documentation for an object [ show source ]
    x = Origin mimic 
    x cell(:documentation) kind should ==("NativeMethod") 
    x documentation = "Wow, you didn't believe that, right?" 
    x cell(:documentation) kind should ==("NativeMethod") 
    x documentation should ==("Wow, you didn't believe that, right?") 
    
    
  • - should return the documentation string set [ show source ]
    (Origin mimic documentation = "something") should ==("something") 
    
    
  • - should validate type of argument [ show source ]
    fn(Origin mimic documentation = []) should signal(Condition Error Type IncorrectType) 
    
    
hash()

returns a hash for the object

Base hash
  • - should be different for different objects [ show source ]
    Origin mimic hash should not ==(Origin mimic hash) 
    
    
  • - should be the same for the same object [ show source ]
    x = Origin mimic 
    x hash should ==(x hash) 
    
    
identity()

returns this object

Base identity
  • - should return a newly created Origin [ show source ]
    x = Origin mimic 
    x identity should be same(x) 
    
    
mimic()

will return a new derivation of the receiving object. Might throw exceptions if the object is an oddball object.

Base mimic
  • - should be able to mimic Origin [ show source ]
    result = Origin mimic 
    result should have kind("Origin") 
    result should not be same(Origin) 
    
    
  • - should be able to mimic Ground [ show source ]
    result = Ground mimic 
    result should have kind("Ground") 
    result should not be same(Ground) 
    
    
  • - should be able to mimic Base [ show source ]
    result = Base mimic 
    result kind should ==("Base") 
    
    
  • - should be able to mimic Text [ show source ]
    result = Text mimic 
    result should have kind("Text") 
    result should not be same(Text) 
    
    
  • - should not be able to mimic nil [ show source ]
    fn(nil mimic) should signal(Condition Error CantMimicOddball) 
    
    
removeCell!(cellName)

expects one evaluated text or symbol argument and removes that cell from the current receiver. if the current receiver has no such object, signals a condition. note that if another cell with that name is available in the mimic chain, it will still be accessible after calling this method. the method returns the receiver.

Base removeCell!
  • - should remove the cell [ show source ]
    x = Origin mimic 
    x flurgus_cell_test = 123 
    x removeCell!(:flurgus_cell_test) 
    x cell?(:flurgus_cell_test) should be false 
    
    
  • - should signal a condition if no such cell exists [ show source ]
    fn(Origin mimic removeCell!(:foo)) should signal(Condition Error NoSuchCell) 
    
    
  • - should offer an ignore restart if the cell can't be found [ show source ]
    x = Origin mimic 
    fn(x removeCell!(:foo)) should offer(restart(ignore, fn)) 
    fn(x removeCell!(:foo)) should returnFromRestart(:ignore) ==(x) 
    
    
  • - should only remove a cell on the current object [ show source ]
    x = Origin mimic 
    y = x mimic 
    x foo = "blurg" 
    y foo = "blarg" 
    y removeCell!(:foo) 
    y cell?(:foo) should be true 
    y foo should ==("blurg") 
    
    
undefineCell!(cellName)

expects one evaluated text or symbol argument and makes that cell undefined in the current receiver. what that means is that from now on it will look like this cell doesn't exist in the receiver or any of its mimics. the cell will not show up if you call cellNames on the receiver or any of the receivers mimics. the undefined status can be removed by doing removeCell! on the correct cell name. a cell name that doesn't exist can still be undefined. the method returns the receiver.

Base undefineCell!
  • - should remove the cell [ show source ]
    x = Origin mimic 
    x flurgus_cell_test = 123 
    x undefineCell!(:flurgus_cell_test) 
    x cell?(:flurgus_cell_test) should be false 
    
    
  • - should not signal a condition if no such cell exists [ show source ]
    Origin mimic undefineCell!(:test_undefine_cell) 
    
    
  • - should make the cell inaccessible [ show source ]
    x = Origin mimic 
    y = x mimic 
    x foo = "blurg" 
    y foo = "blarg" 
    y undefineCell!(:foo) 
    x cell?(:foo) should be true 
    y cell?(:foo) should be false 
    fn(y foo) should signal(Condition Error NoSuchCell) 
    fn(y mimic foo) should signal(Condition Error NoSuchCell) 
    
    
  • - should stop the cell from showing up in cellNames [ show source ]
    x = Origin mimic 
    y = x mimic 
    x foo = "blurg" 
    y foo = "blarg" 
    y undefineCell!(:foo) 
    x cellNames should ==([](:foo)) 
    y cellNames should ==([]) 
    x cellNames(true) should include(:foo) 
    y cellNames(true) should not include(:foo) 
    y mimic cellNames(true) should not include(:foo) 
    z = y mimic 
    z foo = 123 
    z cellNames(true) should include(:foo) 
    
    
  • - should stop the cell from showing up in cells [ show source ]
    x = Origin mimic 
    y = x mimic 
    x foo = "blurg" 
    y foo = "blarg" 
    y undefineCell!(:foo) 
    x cells should ==({}(foo: "blurg")) 
    y cells should ==({}) 
    x cells(true) keys should include(:foo) 
    y cells(true) keys should not include(:foo) 
    y mimic cells(true) keys should not include(:foo) 
    z = y mimic 
    z foo = 123 
    z cells(true) keys should include(:foo) 
    
    
  • - should stop the cell from being able to get with cell [ show source ]
    x = Origin mimic 
    y = x mimic 
    x foo = "blurg" 
    y foo = "blarg" 
    y undefineCell!(:foo) 
    x cell(:foo) should ==("blurg") 
    fn(y cell(:foo)) should signal(Condition Error NoSuchCell) 
    z = y mimic 
    z foo = 123 
    z foo should ==(123) 
    
    
  • - should stop the cell from showing up with cellOwner [ show source ]
    x = Origin mimic 
    y = x mimic 
    x foo = "blurg" 
    y foo = "blarg" 
    y undefineCell!(:foo) 
    fn(y cellOwner(:foo)) should signal(Condition Error NoSuchCell) 
    
    
  • - should stop the cell from showing up with cellOwner? [ show source ]
    x = Origin mimic 
    y = x mimic 
    x foo = "blurg" 
    y foo = "blarg" 
    y undefineCell!(:foo) 
    fn(y cellOwner?(:foo)) should signal(Condition Error NoSuchCell) 
    
    
  • - should be possible to remove the undefine with removeCell! [ show source ]
    x = Origin mimic 
    y = x mimic 
    x foo = "blurg" 
    y foo = "blarg" 
    y undefineCell!(:foo) 
    y removeCell!(:foo) 
    y foo should ==("blurg")