Eugene Vigdorchik | 15 May 15:42

Re: [groovy-dev] I'll give a Groovy presentation at the Jazoon'08

It is what is returned from the body of the method. I see your point here, that the user doesn't see this when calling the method, but the IDE could analyze the method and present this type to the user (it should, really:).

Eugene.

On Thu, May 15, 2008 at 5:14 PM, Martin C. Martin <martin-i949vRgkDusU9HFyfbEPPQC/G2K4zDHf@public.gmane.org> wrote:


Eugene Vigdorchik wrote:
Hi,
It suffices to put the types on parameters only, the return type then should be inferable.
(Recursive methods are an exception, but that is another story)

By the compiler, or by the user?  How would a user infer the return type of something like this:

def getAllConnectingCities(String origin_city)

?

From the name, it's probably returning a collection.  But is it a Set, a List, an array, or a hash table?  Or is it returning multiple values wrapped in an Object[], say the collection along with distance of the nearest and furthest cities?

Best,
Martin

Eugene.


On Thu, May 15, 2008 at 5:02 PM, Martin C. Martin <martin-i949vRgkDusU9HFyfbEPPQC/G2K4zDHf@public.gmane.org <mailto:martin-i949vRgkDusU9HFyfbEPPQC/G2K4zDHf@public.gmane.org>> wrote:



   Aaron Digulla wrote:

       Quoting "Martin C. Martin" <martin-i949vRgkDusU9HFyfbEPPQC/G2K4zDHf@public.gmane.org
       <mailto:martin-i949vRgkDusU9HFyfbEPPQC/G2K4zDHf@public.gmane.org>>:


           Do you think it would be appropriate to point out these
           advantages,
           along with the disadvantages?


       You're right. I wanted to avoid doing a second "what's great
       about groovy" presentation (Ted Neward already does that on
       Monday and I probably can't compete with him :) and while doing
       so, I went too far. Thanks for pointing that out.


   No problem.  And thanks for allowing us to look over your
   presentation before you give it.  You seem genuinely interested in
   telling the audience what they should know if they're considering
   Groovy, which I suspect is why you're so willing to discuss the
   presentation in the first place.

   I think a lot of what you've experienced is exposure to a different
   culture.  I always find this opens my eyes: things I'd taken for
   granted as positives in my old culture are now seen as both good and
   bad.  I used to believe that static typing meant increased
   productivity, because the compiler could catch problems and save me
   lots of debugging time. But after using a number of dynamic
   languages, I can see the costs: reading C++ or Java code now looks
   like talking to a child, since you have to spell out every little
   thing, even things that should be obvious.

   I've gotten into a habit of putting types on most function
   declarations, both arguments and return.  A function declaration is
   a unit of abstraction, and callers generally don't have to look
   inside it to know how to call it.  But in the function body I
   usually skip the types, to make it more readable.

   Out of curiosity, does anybody else use that pattern?

   Best,
   Martin




   ---------------------------------------------------------------------
   To unsubscribe from this list, please visit:

     http://xircles.codehaus.org/manage_email




---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email




Gmane