Hi Mark,
Smells similar to how Matlab passes multiple return arguments. The []
give the feeling that it is an array, which I like, but I'm not too
keen on accessing the elements by index. Following is an alternate
suggestion for how to use the return arguments:
[Integer foo, String bar] = doSomething();
Better yet, if we could infer types then:
var [foo, bar] = doSomething();
also, one could ignore return arguments if not required. For example:
[null, String bar] = doSomething();
or [, String bar] = doSomething();
I think it's important to package the return arguments, for clarity
sake. As such, I would be uncomfortable with:
Integer foo, String bar = doSomething();
Cheers,
Jason
On Feb 9, 3:55 am, Mark Derricutt <[email protected]> wrote:
> We have Tuple2, Tuple3, Tuple4 in our utils package, rather handy. Wish
> this was avaialable directly in the language, probably as form of
> generic/typed "array", maybe something like:
>
> public [Integer,String] doSomething() {
> return new [Integer,String] {5, "Hello"};
>
> }
>
> ...
> Integer foo = doSomething()[0];
>
> This reuses the style of an array, but specifying a type signature for each
> element. Anyone know if this would be a viable suggestion?
>
> ...and then Buffy staked Edward. The End.
>
> On Mon, Feb 9, 2009 at 2:12 AM, [email protected] <
>
> [email protected]> wrote:
>
> > This is the first time I've felt the need to change the language. I
> > guess everybody else here wants other changes. I've got this class in
> > every project I've worked on for the last 2 years. Anybody has a
> > better one?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "The
Java Posse" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaposse?hl=en
-~----------~----~----~----~------~----~------~--~---