15 May 15:30
[groovy-dev] Declaring multiple return types (Was: Re: [groovy-dev] I'll give a Groovy presentation at the Jazoon'08)
From: Aaron Digulla <digulla@...>
Subject: [groovy-dev] Declaring multiple return types (Was: Re: [groovy-dev] I'll give a Groovy presentation at the Jazoon'08)
Newsgroups: gmane.comp.lang.groovy.devel
Date: 2008-05-15 13:30:08 GMT
Subject: [groovy-dev] Declaring multiple return types (Was: Re: [groovy-dev] I'll give a Groovy presentation at the Jazoon'08)
Newsgroups: gmane.comp.lang.groovy.devel
Date: 2008-05-15 13:30:08 GMT
Quoting "Martin C. Martin" <martin@...>: >> 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? Hm... there is a feature request lurking here: class City { [City, double distance] getClosestCity() { ... } } to declare the types of the two return values (along with the information that the method returns two values and what they mean). Regards, -- -- Aaron "Optimizer" Digulla a.k.a. Philmann Dark "It's not the universe that's limited, it's our imagination. Follow me and I'll show you something beyond the limits." http://www.pdark.de/ --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
RSS Feed