Boo
  1. Boo
  2. BOO-409

Using as cast with callables

    Details

    • Type: Improvement Improvement
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.5.6
    • Fix Version/s: 0.6
    • Component/s: Compiler
    • Labels:
      None
    • Testcase included:
      yes
    • Number of attachments :
      1

      Description

      "kbarros" identified this issue.

      To cast a method to a specific callable type, right now we can only use cast() or implicit casts. As casts always fail. Example below. I attached a patch that I hope is the right way to allow as casts to work.

      callable OutputHandler(message as string)

      def printit(message as string):
      System.Console.WriteLine(message)

      //works
      handler as OutputHandler = printit
      handler("Testing...")

      //doesn't work, null ref exception
      handlerb = printit as OutputHandler
      handlerb("Testing B...")

        Activity

        Hide
        Rodrigo B. de Oliveira added a comment -

        patch applied. thanks!

        Show
        Rodrigo B. de Oliveira added a comment - patch applied. thanks!

          People

          • Assignee:
            Doug H
            Reporter:
            Doug H
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: