Classes | Language

Message : Object

A message to an object
Source: Message.sc

Description

A message to an object, to be evaluated later.

Class Methods

Message.new(receiver, selector, args)

Arguments:

receiver

the receiver of the message

selector

the method to be called

args

arguments to the call

Inherited class methods

Instance Methods

.receiver

.receiver = value

the object to which the message is relayed

.selector

.selector = value

the method to be called

.args

.args = value

the arguments to the call

.value( ... moreArgs)

send the message to the receiver and call the selector with the arguments

Arguments:

... moreArgs

Inherited instance methods

Examples

// an object
a = 36


// a message to the object
m = Message(a, \sqrt)

// deliver the message
m.value
// -> 6

// a message that lacks an argument
m = Message(a, '+')

// evaluate with the argument
m.value(6)
// -> 42

m.value(-13)
// -> 23