Boo
  1. Boo
  2. BOO-1102

Type inference for closures

    Details

    • Type: New Feature New Feature
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.9
    • Component/s: Compiler
    • Labels:
      None
    • Testcase included:
      yes
    • Number of attachments :
      0

      Description

      Boo should pick up a closure's missing parameter types from its context.

      Declaration context:

      closure as callable(int) as bool  = { i | i > 3 }
      

      Assignment context:

      closure as callable(int) as bool
      closure = { i | i > 3}
      

      Event subscribe context:

      event MyEvent as callable(int) as void
      MyEvent += { i | print i }
      

      Cast context:

      closure = { i | i > 3 } as Predicate[of int]
      

      Method invocation context:

      list = List[of int]()
      list.FindAll({ i | i > 3})
      

      This functionality should be combined together with overload resolution and type inference for generic method invocations. This will make Boo's type inference capabilities on par with C# 3.0.

        Issue Links

          Activity

          Hide
          Avishay Lavie added a comment -

          Landed in revision 3117.

          Show
          Avishay Lavie added a comment - Landed in revision 3117.
          Hide
          Rodrigo B. de Oliveira added a comment -

          WAHOO!!!!

          Show
          Rodrigo B. de Oliveira added a comment - WAHOO!!!!

            People

            • Assignee:
              Avishay Lavie
              Reporter:
              Avishay Lavie
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: