Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #22057

Re: refactoring problem

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.erje.net!us.feeder.erje.net!newsfeed.straub-nv.de!news-1.dfn.de!news.dfn.de!news.informatik.hu-berlin.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Robert Klemme <shortcutter@googlemail.com>
Newsgroups comp.lang.java.programmer
Subject Re: refactoring problem
Date Sun, 03 Feb 2013 21:38:27 +0100
Lines 87
Message-ID <an8067F49jkU1@mid.individual.net> (permalink)
References <7fssg8dakvofmv6pk3sfvp5jmaku55vgmm@4ax.com> <kem88s$72o$1@dont-email.me> <510ea8de$0$284$14726298@news.sunsite.dk> <kem9p7$i12$1@dont-email.me> <510ead27$0$291$14726298@news.sunsite.dk> <fchf9drspafa$.1gdx8d2qly77i$.dlg@40tude.net>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding quoted-printable
X-Trace individual.net v8IfXiWynPyS8rEEE4sPzgBRXoq734XRxYdvhuku+5TB6lxuAtVnE2Ki97/+osQfQ=
Cancel-Lock sha1:J8lPi+oDtq+2kFzUKHxjsqABgrM=
User-Agent Mozilla/5.0 (Windows NT 6.0; WOW64; rv:17.0) Gecko/20130107 Thunderbird/17.0.2
In-Reply-To <fchf9drspafa$.1gdx8d2qly77i$.dlg@40tude.net>
Xref csiph.com comp.lang.java.programmer:22057

Show key headers only | View raw


On 03.02.2013 19:50, Peter Duniho wrote:
> On Sun, 03 Feb 2013 13:32:08 -0500, Arne Vajhøj wrote:
>
>> [...]
>>>> (int a; double b; String c) = multiReturnValueMethod();
>>>>
>>>> sure does look funky!
>>>
>>> Perl does it.
>>
>> How do I phrase this to avoid a language war.
>>
>> Hm.
>>
>> Perl is not designed to make it difficult to write funky code.

Well put, Arne! ;-)

> On the other hand, F# is designed that way and it supports tuple return
> values as well.
>
> I doubt we'll ever see the feature in C-based languages like Java and C#,
> but there are other languages that support it, and in at least some of
> those examples, they do it gracefully.

If you want a language that does it gracefully and runs on the JVM you 
can pick JRuby.

> That said, it seems perfectly fine to me in Java to declare a container
> type to allow multiple values to be returned. It's a common enough idiom
> and works well.

Absolutely!

And if it was as easy as in (J)Ruby to declare a simple data container 
class it would even be convenient.

# Ruby (without final though)
FooBar = Struct.new :name, :length, :color

// Java
public struct FooBar {
   final String name;
   int length;
   Color color;
}

could generate

public class FooBar {
   private final String name;
   private int length;
   private Color color;

   public(String name) {
     this.name = name;
   }

   public(String name, int length, Color color) {
     this.name = name;
     this.length = length;
     this.color = color;
   }

   public String getName() { return name; }
   // ...

   @Override
   public int hashCode() {...}

   @Override
   public boolean equals(Object o) {...}

}

Cheers

	robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

refactoring problem Roedy Green <see_website@mindprod.com.invalid> - 2013-02-03 06:30 -0800
  Re: refactoring problem Martin Gregorie <martin@address-in-sig.invalid> - 2013-02-03 16:23 +0000
  Re: refactoring problem Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-02-03 12:27 -0400
    Re: refactoring problem Roedy Green <see_website@mindprod.com.invalid> - 2013-02-03 12:35 -0800
      Re: refactoring problem Arne Vajhøj <arne@vajhoej.dk> - 2013-02-03 15:37 -0500
    Re: refactoring problem Leif Roar Moldskred <leifm@dimnakorr.com> - 2013-02-03 15:21 -0600
      Re: refactoring problem Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-02-03 17:38 -0400
      Re: refactoring problem Arne Vajhøj <arne@vajhoej.dk> - 2013-02-03 16:46 -0500
    Re: refactoring problem Lew <lewbloch@gmail.com> - 2013-02-03 14:36 -0800
  Re: refactoring problem Arne Vajhøj <arne@vajhoej.dk> - 2013-02-03 11:34 -0500
  Re: refactoring problem Joshua Cranmer <Pidgeot18@verizon.invalid> - 2013-02-03 11:54 -0600
    Re: refactoring problem Arne Vajhøj <arne@vajhoej.dk> - 2013-02-03 13:13 -0500
      Re: refactoring problem Knute Johnson <nospam@knutejohnson.com> - 2013-02-03 10:20 -0800
        Re: refactoring problem Arne Vajhøj <arne@vajhoej.dk> - 2013-02-03 13:32 -0500
          Re: refactoring problem Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2013-02-03 10:50 -0800
            Re: refactoring problem Robert Klemme <shortcutter@googlemail.com> - 2013-02-03 21:38 +0100
            Re: refactoring problem "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2013-02-04 08:11 +0000
              Re: refactoring problem Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2013-02-04 03:56 -0800
      Re: refactoring problem Silvio <silvio@internet.com> - 2013-02-04 13:21 +0100
        Re: refactoring problem Lew <lewbloch@gmail.com> - 2013-02-04 12:35 -0800
          Re: refactoring problem Silvio <silvio@internet.com> - 2013-02-04 22:15 +0100
            Re: refactoring problem Lew <lewbloch@gmail.com> - 2013-02-04 13:49 -0800
              Re: refactoring problem Silvio <silvio@internet.com> - 2013-02-04 23:51 +0100
            Re: refactoring problem Lew <lewbloch@gmail.com> - 2013-02-04 13:53 -0800
              Re: refactoring problem Silvio <silvio@internet.com> - 2013-02-04 23:48 +0100
                Re: refactoring problem Lew <lewbloch@gmail.com> - 2013-02-04 17:08 -0800
                Re: refactoring problem Silvio <silvio@internet.com> - 2013-02-05 10:07 +0100
                Re: refactoring problem Lew <lewbloch@gmail.com> - 2013-02-05 13:13 -0800
                Re: refactoring problem Jim Gibson <jimsgibson@gmail.com> - 2013-02-05 13:20 -0800
                Re: refactoring problem Lew <lewbloch@gmail.com> - 2013-02-05 13:31 -0800
                Re: refactoring problem Arne Vajhøj <arne@vajhoej.dk> - 2013-02-05 21:42 -0500
            Re: refactoring problem Arne Vajhøj <arne@vajhoej.dk> - 2013-02-04 18:33 -0500
          Re: refactoring problem Arne Vajhøj <arne@vajhoej.dk> - 2013-02-04 18:32 -0500
            Re: refactoring problem Martin Gregorie <martin@address-in-sig.invalid> - 2013-02-05 01:50 +0000
          Re: refactoring problem Joshua Cranmer <Pidgeot18@verizon.invalid> - 2013-02-05 10:04 -0600
            Re: refactoring problem Gene Wirchenko <genew@telus.net> - 2013-02-05 10:38 -0800
              Re: refactoring problem Joshua Cranmer <Pidgeot18@verizon.invalid> - 2013-02-05 13:53 -0600
            Re: refactoring problem Arne Vajhøj <arne@vajhoej.dk> - 2013-02-05 21:43 -0500
              Re: refactoring problem markspace <markspace@nospam.nospam> - 2013-02-05 19:15 -0800
                Re: refactoring problem Arne Vajhøj <arne@vajhoej.dk> - 2013-02-08 23:58 -0500
  Re: refactoring problem Joerg Meier <joergmmeier@arcor.de> - 2013-02-05 11:09 +0100

csiph-web