Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-2264

support overloading with keyword 'as'

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 1.1-rc-2
    • 1.6-rc-2
    • groovy-jdk
    • None

    Description

      We can not implement overloading methods in the interfaces, please provide a way to complete it.

      Thanks.

      interface Talkable {
           void  sayHello(String name)
           void sayHello()
      }
      
      def man  =  [
          sayHello: {String name  ->  println  " Hello, $name " },  // maybe "sayHello(String)" :{String name  ->  println  " Hello, $name " }   is better
          sayHello: { -> println "Hello, world"}  // "sayHello()" :{ -> println "Hello, world"}  
      ] as Talkable
      
      man.sayHello( " Daniel " )
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            daniel_sun Daniel Sun
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: