Skip to content
Baltasar García Perez-Schofield edited this page Jan 15, 2018 · 1 revision

Object's API

All objects inherit from Object, directly or via other, intermediate objects. The available methods are the explained below.

  • name

Returns the object's name.

Example:

> Object name
Object
  • setName Str1
  • rename Str1

Changes the name of the object.

Example:

> Object rename "Obj"
Obj
  • list

Lists all attributes and methods in the object.

Example:

> Object list
Object: Object = {
    str = {: }
    ...
}
  • str

Shows the data in the object, by means of sending it the str message. Object holds a basic implementation that lists the available attributes (not methods), with their values. This can be overriden by creating the str method in the object.

Example:

> Point str
{ x = 0 y = 0}
> Point str = {: "()" }
()
  • path

Returns the object's path. This path provides a unique identifier for the object.

Example:

> Object name
Root.Object
  • createChild

Creates a new, empty object, with its parent attribute pointing to the object that received the message. When this message is sent to Object it creates a new object similar to anObject.

Example:

> Object createChild
Object1
  • copy

Creates a new object, being an exact copy of the object that received the message.

Example:

> Point
0, 0
> Point copy
Object2
> Object2
0, 0
  • erase Str1

Removes the Str1 member from the object that receives the message.

Example:

> Point list
Point: Object = {
    x: Int = 0
    y: Int = 0
}

> Point erase "x"
Point
> Point list
Point: Object = {
    y: Int = 0
}
  • set Str1 Obj1

Changes the value of the member denoted by Str1 to be Obj1. This is better shortened as shown below.

<obj>.<member> = *Obj1*

Example:

> Point set "x" 0
Point
> Point.y = 0
  • is? Obj1

Returns true or false, depending on whether the parent points directly or through other intermediate objects to Obj1.

Example:

> Point is? Object
true
Clone this wiki locally