What does the ':' Operator do?

Former Member
Former Member
I've checked the documentation, and this closest I can see to it being referenced is:

To create a callback in Monkey C, create a Method object. Method objects are a combination of the function and the object instance or module they originate from. You can then call the method using method():
// Handle completion of long
function wakeMeUpBeforeYouGoGo() {
// Do something here
}

// Create a call back with the method method (jinx!)
doLongRunningTask( method( :wakeMeUpBeforeYouGoGo ) );



Can anyone explain what this operator does?
  • It's not an operator - it's how you denote a symbol. (vs a var for example)

    In your example, you pass method() the symbol wakeMeUpBeforeYouGoGo (:wakeMeUpBeforeYouGoGo ), meaning the function wakeMeUpBeforeYouGoGo ()

    You'll also see symbols used for a number of things.
  • Former Member
    Former Member over 8 years ago
    Ah right, thank you for clearing that up - I don't know how I missed that in the documentation.