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


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

Re: can this be done with generics?

X-Received by 10.182.19.231 with SMTP id i7mr3979273obe.25.1385372861063; Mon, 25 Nov 2013 01:47:41 -0800 (PST)
X-Received by 10.49.13.40 with SMTP id e8mr751940qec.1.1385372861030; Mon, 25 Nov 2013 01:47:41 -0800 (PST)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!i2no5143093qav.0!news-out.google.com!9ni3046qaf.0!nntp.google.com!i2no5143088qav.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.java.programmer
Date Mon, 25 Nov 2013 01:47:40 -0800 (PST)
In-Reply-To <0220ee18-c57b-4b6e-b98f-5a2323d99427@googlegroups.com>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=195.63.184.88; posting-account=QuOrbQoAAADk1Ytmd4kkfWK7_Nh1pnw_
NNTP-Posting-Host 195.63.184.88
References <slrnl9580s.42s.avl@gamma.logic.tuwien.ac.at> <5292b1e5$0$301$14726298@news.sunsite.dk> <0220ee18-c57b-4b6e-b98f-5a2323d99427@googlegroups.com>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <ee863bf5-c1ee-49ff-895b-4dca837579f4@googlegroups.com> (permalink)
Subject Re: can this be done with generics?
From Saxo <jeti789@web.de>
Injection-Date Mon, 25 Nov 2013 09:47:41 +0000
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
Xref csiph.com comp.lang.java.programmer:26601

Show key headers only | View raw


Am Montag, 25. November 2013 10:43:07 UTC+1 schrieb Saxo:
> > If you want to code like this you need dynamic typed language.
> 
> 
> 
> Yes, that's right. Or you need a semi-typed language like Objective-C where you can do things exactly as intended in your port. Objective-C has a special type named "id", which will be of the type at runtime of the object returned at runtime. The Objective-C will issue a warning when you return an object of type id and leave things to your responsability whether things will work well.
> 
> 
> 
> There is also Fantom on the JVM that has that feature as Objective-C. In Scala you can get this accomplished through the use of implicits (see this article: http://objectscape.blogspot.de/2013/08/scala-implicits-conversion-on-steroids.html). But you may run into problems that things become hard to read when you use too many implicits. But for Java it can't be done as for any statically typed language that does not have holes in its typing system.
> 
> 
> 
> Cheers, Saxo

I forgot: Think it can be done in Ceylon (ceylon-lang.org). Ceylon has a special feature that can be used in that way. Lets say you have a class A with a method foo() and a class B, which is a subclass of A and also has a method foo(). If I remember right in Ceylon A.foo() and B.foo() may have different return types. But this is the only statitcally type OOPL I know of that can do this.

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


Thread

can this be done with generics? Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2013-11-25 00:55 +0000
  Re: can this be done with generics? Arne Vajhøj <arne@vajhoej.dk> - 2013-11-24 21:11 -0500
    Re: can this be done with generics? Saxo <jeti789@web.de> - 2013-11-25 01:43 -0800
      Re: can this be done with generics? Saxo <jeti789@web.de> - 2013-11-25 01:47 -0800
      Re: can this be done with generics? Arne Vajhøj <arne@vajhoej.dk> - 2013-11-26 21:32 -0500
    Re: can this be done with generics? Silvio <silvio@internet.com> - 2013-11-25 11:30 +0100
      Re: can this be done with generics? Saxo <jeti789@web.de> - 2013-11-25 02:36 -0800
      Re: can this be done with generics? Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2013-11-25 10:45 +0000
      Re: can this be done with generics? Arne Vajhøj <arne@vajhoej.dk> - 2013-11-26 21:35 -0500
        Re: can this be done with generics? Silvio <silvio@internet.com> - 2013-11-27 10:48 +0100
        Re: can this be done with generics? Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2013-11-27 10:18 +0000
  Re: can this be done with generics? Patrick Roemer <sangamon@netcologne.de> - 2013-11-25 12:59 +0100
    Re: can this be done with generics? Robert Klemme <shortcutter@googlemail.com> - 2013-11-25 22:31 +0100
      Re: can this be done with generics? Patrick Roemer <sangamon@netcologne.de> - 2013-11-26 12:03 +0100
      Re: can this be done with generics? v_borchert@despammed.com (Volker Borchert) - 2013-11-26 21:32 +0000
        Re: can this be done with generics? Robert Klemme <shortcutter@googlemail.com> - 2013-11-26 23:30 +0100
      Re: can this be done with generics? Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2013-11-27 18:53 +0000
        Re: can this be done with generics? Sebastian <news@seyweiler.dyndns.org> - 2013-11-28 22:28 +0100
          Re: can this be done with generics? Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2013-11-30 14:21 +0000
  Re: can this be done with generics? Mike Amling <mamling@chaff.us> - 2013-11-25 09:02 -0600
    Re: can this be done with generics? Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2013-11-26 01:04 +0000
      Re: can this be done with generics? Robert Klemme <shortcutter@googlemail.com> - 2013-11-26 08:16 +0100
        Re: can this be done with generics? Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2013-11-26 20:42 +0000
    Re: can this be done with generics? Arne Vajhøj <arne@vajhoej.dk> - 2013-11-26 21:38 -0500
      Re: can this be done with generics? Mike Amling <mamling@chaff.us> - 2013-11-27 11:05 -0600
  Re: can this be done with generics? taqmcg@gmail.com - 2013-11-25 08:36 -0800
    Re: can this be done with generics? taqmcg@gmail.com - 2013-11-25 09:04 -0800
      Re: can this be done with generics? Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2013-11-26 00:50 +0000
        Re: can this be done with generics? Arivald <NOSPAMarivald@interia.pl> - 2013-11-26 07:10 +0100
          Re: can this be done with generics? Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2013-11-27 18:58 +0000
  Re: can this be done with generics? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-12-07 09:04 -0800
    Re: can this be done with generics? Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2013-12-07 19:20 +0000
      Re: can this be done with generics? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-12-10 11:14 -0800

csiph-web