Any object created from scratch should usually be derived from Origin.

Mimics
Inactive cells
Active cells
Specs
Origin around mimic
  • - should ignore arguments sent to mimic [ show source ]
    fn(Origin mimic(1, 2, 3, 4, 5)) should not signal(Condition Error) 
    
    
  • - should call initalize if such a cell exists [ show source ]
    X = Origin mimic 
    Ground argumentsGiven = [] 
    X initialize = method(+(rest), +:(krest), argumentsGiven <<([](rest, krest))) 
    X mimic(12, foo: 42, 555 +(2)) 
    argumentsGiven should ==([]([]([](12, 557), {}(foo: 42)))) 
    
    
  • - should return a new mimic of the object [ show source ]
    X = Origin mimic 
    x = X mimic 
    x should not be same(X) 
    x should be mimic(X) 
    
    
Origin notice
  • - should return 'Origin [ show source ]
    Origin notice should ==("Origin") 
    
    
  • - should not return 'Origin' for a mimic [ show source ]
    Origin mimic notice should not ==("Origin") 
    
    
Inactive cells (details)
kind = "Origin"
Active cells (details)
===(other)

nil

method(other, 
  if(self same?(
      #<Origin:FB4538D>), 
    Reflector other:mimics?(cell(:other), 
      #<Origin:FB4538D>), 
    bind(rescue(Condition Error, fn(c, false)), 
      self ==(
        other))))
Origin ===
  • - should check for mimicness if receiver is Origin [ show source ]
    Origin should ===(Origin) 
    Origin should ===(Origin mimic) 
    Origin should ===("foo") 
    Origin should not ===(Ground) 
    
    
  • - should check for equalness if receiver is not Origin [ show source ]
    x = Origin mimic 
    y = Origin mimic 
    z = Origin mimic 
    z == = fnx(other, other same?(x)) 
    x should ===(x) 
    x should not ===(y) 
    x should not ===(Origin) 
    x should not ===(z) 
    z should not ===(z) 
    z should ===(x) 
    
    
eval(source)

Takes some Text and evaluates it as Ioke source in the context of the receiver

method(source, 
  Message fromText(source) evaluateOn(self))
Origin eval
  • - should eval on the receiver [ show source ]
    x = Origin mimic 
    x foo = 42 
    x eval("foo should == 42") 
    x eval("identity") should be same(x) 
    
    
  • - should eval an empty string [ show source ]
    Origin eval("") should ==(nil) 
    
    
  • - should eval a number [ show source ]
    Origin eval("1") should ==(1) 
    
    
  • - should eval a simple message [ show source ]
    Origin eval("[](1,2,3,4)") should ==([](1, 2, 3, 4)) 
    
    
  • - should eval a message with operator shuffling [ show source ]
    Origin eval("1 + 2") should ==(3) 
    
    
  • - should eval multiple message chains [ show source ]
    Origin eval("sam = 1. boris = 5. sooze = 10. sam + boris + sooze") should ==(16) 
    
    
mimic(...)

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

macro(
  aspectCall = macro(ss = if(@ kind ==("Locals"), @ self, @) 
      call resendToValue(@@ cell(:primary), ss)) 
  cell(:aspectCall) primary = @@ cell(:primary) 
  call activateValueWithCachedArguments(@@ cell(:advice), self, aspectCall: cell(:aspectCall)) 
  )
print()

Prints a text representation to standard output

Origin print
  • - should print asText of object to 'System out' [ show source ]
    oldSystemOutPrint = System out cell(:print) 
    Ground expected = nil 
    System out print = method(arg, Ground expected = arg) 
    "foobarz" print 
    System out print = cell(:oldSystemOutPrint) 
    expected should ==("foobarz") 
    
    
println()

Prints a text representation and a newline to standard output

Origin println
  • - should print asText of object to 'System out' [ show source ]
    oldSystemOutPrintln = System out cell(:println) 
    Ground expected = nil 
    System out println = method(arg, Ground expected = arg) 
    "foobarz" println 
    System out println = cell(:oldSystemOutPrintln) 
    expected should ==("foobarz")