Search code examples
boomethod-signaturemultiple-return-values

Multiple Return Type Syntax in Boo?


I'm trying to define a method in Boo which returns two things, but the compiler is spitting out the message:

expecting "COLON", found ','.

Here's how I tried defining the method:

from System.Collections.Generic import HashSet

# ValueParameter is a class defined elsewhere.
def evaluate(s as string, limit as string) as double, HashSet[of ValueParameter]:

I've looked through the docs, and though I see examples of how to return multiple items, I don't see any examples where they declare the return type as returning multiple types.


Solution

  • I found the swap example on the wiki, which declares a function that uses multiple return values, and ran it through the compiler with the -p:boo flag, which outputs a code representation of the final form of the AST after all the processing has been done. It reports that the type of this function is (int). When you return two dissimilar types, such as your double and HashSet, the return type is (object).