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


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

Re: refactoring problem

From Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com>
Subject Re: refactoring problem
Newsgroups comp.lang.java.programmer
References (2 earlier) <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> <_NSdnTwBOp8B85LMnZ2dnUVZ8u-dnZ2d@bt.com>
Date 2013-02-04 03:56 -0800
Message-ID <1s751sumimswf.zr11lenjkzq2$.dlg@40tude.net> (permalink)

Show all headers | View raw


On Mon, 4 Feb 2013 08:11:01 -0000, Chris Uppal wrote:

> Peter Duniho wrote:
> 
>> I doubt we'll ever see the feature in C-based languages like Java and C#,
> 
> C# has anonymous tuples.  They had to add 'em to support Linq (or at least, 
> that's my current understanding -- I'm neither an expert in the semantics nor 
> the history of C#).

.NET has a series of "Tuple" generic types, and indeed F# leverages these
types for its implementation of tuples.

But C# does not elevate the tuple to a language-supported feature, the way
that languages like Perl, F#, and others do. I.e. there's no special syntax
for declaring a tuple return type, nor of naming the individual members of
a tuple (in the .NET "Tuple" types, each element is simply named "Item1",
"Item2", etc.; C# does nothing to abstract this to user-declared names as
F# does).

As part of LINQ, C# does allow anonymous types, and in fact for these types
each individual member can have a user-declared name. But the user-declared
member name is really only useful in the method in which the type is
declared.

Instances of the anonymous type aren't returnable from methods in any
practical way. They can be passed to generic methods called from the method
in which they are declared (since a generic method doesn't actually care
what the members of the type parameter are), but they can't be returned
from the declaring method except as a plain "object". The caller of the
declaring type would have to access the individual components through
reflection.

Pete

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