Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
MessageSend
Last updated at 6:51 pm UTC on 2 August 2013
A MessageSend encapsulates a message, any arguments needed and that can be supplied immediately, and the recipient.
Examples -
MessageSend receiver: 4 selector: #factorial
MessageSend receiver: 4 selector: #+ argument: 3
MessageSend receiver: 4 selector: #between:and: arguments: #(3 5)
The above have all the parameters needed and you just need to send #value to any one of them. Try it in a workspace - just paste in and printIt
(MessageSend receiver: 4 selector: #factorial) value
(MessageSend receiver: 4 selector: #+ argument: 3) value
(MessageSend receiver: 4 selector: #between:and: arguments: #(3 5)) value

Slightly more complex usage allows you to provide the arguments later. Try -
(MessageSend receiver: 4 selector: #+ ) value: 3
(MessageSend receiver: 4 selector: #between:and:) valueWithArguments: (Array with: 2 with: Date today weekdayIndex)

You can even build a MessageSend with fully setup defaults and choose to evaluate it with different arguments later
(MessageSend receiver: 4 selector: #between:and: arguments: #(3 5)) value: 1 value: 3