Search code examples
boo

In Boo, how do I specify an array parameter?


In Boo, let's say I'm overriding a method that takes a parameter that takes string[] urls. Type inference, for whatever reason, isn't matching up to the base class, so I need to explicitly specify the type of the parameter.

class MyClass: MyBase
  override method(urls as Array[of (string)])
    dostuff()

This turns out not to be correct Boo syntax. What's the right way of specifying that I'm overriding a method that takes an array parameter?

Normally I prefer to expect an IEnumerable, but I'm overriding someone else's base class, which is part of Rhino.DSL.

Edited to add: It turns out my issue was only tangentially related to the array declaration syntax... my real problem was two different versions of the Boo Assembly being referenced in my project.


Solution

  • Parenthesis around a type represents an array of that type:

    class MyClass : MyBase
      override def method(urls as (string)):
        dostuff()