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


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

Sidetrack on generics (WAS: Re: are lambdas a way to bring functional programming to java?)

From Daniele Futtorovic <da.futt.news@laposte.net>
Newsgroups comp.lang.java.programmer
Subject Sidetrack on generics (WAS: Re: are lambdas a way to bring functional programming to java?)
Date 2014-07-22 20:48 +0200
Organization A noiseless patient Spider
Message-ID <lqmbln$bm9$1@dont-email.me> (permalink)
References (4 earlier) <MPG.2e1d2056334506bc22@202.177.16.121> <lov3h3$thm$1@news.albasani.net> <lov868$rb$1@dont-email.me> <lqllu1$8fp$1@news.albasani.net> <lqm7k4$cj3$1@dont-email.me>

Show all headers | View raw


On 2014-07-22 19:39, markspace allegedly wrote:
> On 7/22/2014 5:37 AM, Jan Burse wrote:
>> markspace schrieb:
>>>
>>> I think people see something weird in Java that they don't understand,
>>> and they immediately think "it's generics again."  Generics had some
>>> really unfortunate consequences, especially in the long run, that I
>>> don't think the expert group foresaw or completely understood.  (In
>>> their defense, I'm sure they did as good as a job as possible at the
>>> time.)
>>
>> Small question: What unfortunate consequence in respect to
>> generics are people usually refering to? I hear something
>> similar yesterday.
> 
> 
> Oh god, where's my list?
> 
> The main issue, for me, is that generics are non-reifiable.  The entire
> generics system is a fiction maintained by the compiler only, and not
> accessible to the runtime JVM.
> 
> Creating generic arrays does not work.  This can be a problem when
> writing the guts of a generic class.
> 
> Due to erasure, you can't actually cast/type check a generic object. The
> compiler basically throws up its hands and says "sure I guess." Then you
> have to suppress the warning the compiler generates.
> 
> It can be extremely complicated to get the parametrized type of an object.
> 
> Basically you can look through the section on generics of Effective Java
> 2nd ed and see a long list of complications.  The integration into Java
> wasn't (and isn't) really smooth.
> 
> Generics are also invariant, which is actually ok, just really confusing
> for folks who are used to covariant type systems.
> 
> Project Vahalla (OpenJDK, led by Brian Goetz) is looking at making
> generics reifiable.  It's a huge problem to do, but they're working on
> it just because the current implementation has enough weird corners that
> they want to fix it up.  That Oracle is going to spend the time and
> money to fix it tells you something about the current state of generics.

This is all very true. But it being said, I don't think it's a bad thing
it went down like this. I appreciate the restraint with which they
introduced them in the Java language; a restraint which arguably is the
cause of many of the problems you cite. I appreciate the conservatism
and caring caution with which they treat the towering edifice that is
the Java world in general. It is difficult to express exactly why, but
to me at least it makes me more trusting with regards to the things they
actually do introduce.

As far as I could tell, there was some significant resistance to
generics being added to the language altogether in the first place. I
believe the tip-toed first iteration has gone a long way to convincing
critics that it was indeed a beneficial addition to the toolset
(speaking at the very least for myself). And even for those who had been
convinced from the get-go, the half-hearted first iteration might have
provided crucial insights that they might have missed otherwise.

The situation right now is much more promising for a good and "reified"
implementation of generics than it was before. It was a bumpy road, and
it will take a lot of effort and investment to go further, some of it
arguably duplicate. If it even goes further. But I don't think that's a
bad thing. If it even goes further -- the need is less acute than it was
before.

-- 
D.F.

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


Thread

are lambdas a way to bring functional programming to java? gdotone@gmail.com - 2014-06-27 16:50 -0700
  Re: are lambdas a way to bring functional programming to java? Arne Vajhøj <arne@vajhoej.dk> - 2014-06-27 20:14 -0400
    Re: are lambdas a way to bring functional programming to java? Arne Vajhøj <arne@vajhoej.dk> - 2014-06-27 20:23 -0400
      Re: are lambdas a way to bring functional programming to java? Wanja Gayk <brixomatic@yahoo.com> - 2014-06-28 14:43 +0200
        Re: are lambdas a way to bring functional programming to java? markspace <markspace@nospam.nospam> - 2014-07-01 14:34 -0700
          Re: are lambdas a way to bring functional programming to java? Arne Vajhøj <arne@vajhoej.dk> - 2014-07-01 22:01 -0400
          Re: are lambdas a way to bring functional programming to java? Wanja Gayk <brixomatic@yahoo.com> - 2014-07-02 20:52 +0200
            Re: are lambdas a way to bring functional programming to java? markspace <markspace@nospam.nospam> - 2014-07-02 13:08 -0700
              Re: are lambdas a way to bring functional programming to java? Wanja Gayk <brixomatic@yahoo.com> - 2014-07-03 03:13 +0200
              Re: are lambdas a way to bring functional programming to java? Joerg Meier <joergmmeier@arcor.de> - 2014-07-06 14:42 +0200
        Re: are lambdas a way to bring functional programming to java? Arne Vajhøj <arne@vajhoej.dk> - 2014-07-01 22:27 -0400
          Re: are lambdas a way to bring functional programming to java? Arne Vajhøj <arne@vajhoej.dk> - 2014-07-01 22:32 -0400
            Re: are lambdas a way to bring functional programming to java? markspace <markspace@nospam.nospam> - 2014-07-01 19:58 -0700
            Re: are lambdas a way to bring functional programming to java? Wanja Gayk <brixomatic@yahoo.com> - 2014-07-02 22:55 +0200
              Re: are lambdas a way to bring functional programming to java? markspace <markspace@nospam.nospam> - 2014-07-02 15:32 -0700
                Re: are lambdas a way to bring functional programming to java? Gene Wirchenko <genew@telus.net> - 2014-07-03 09:45 -0700
          Re: are lambdas a way to bring functional programming to java? leif.roar@invalid.com (Leif Roar Moldskred) - 2014-07-01 23:48 -0500
            Re: are lambdas a way to bring functional programming to java? Wanja Gayk <brixomatic@yahoo.com> - 2014-07-02 22:55 +0200
              Re: are lambdas a way to bring functional programming to java? Gene Wirchenko <genew@telus.net> - 2014-07-03 09:49 -0700
                Re: are lambdas a way to bring functional programming to java? markspace <markspace@nospam.nospam> - 2014-07-03 10:25 -0700
                Re: are lambdas a way to bring functional programming to java? Gene Wirchenko <genew@telus.net> - 2014-07-04 11:03 -0700
          Re: are lambdas a way to bring functional programming to java? Wanja Gayk <brixomatic@yahoo.com> - 2014-07-02 21:23 +0200
      Re: are lambdas a way to bring functional programming to java? Roedy Green <see_website@mindprod.com.invalid> - 2014-06-30 09:08 -0700
        Re: are lambdas a way to bring functional programming to java? Arne Vajhøj <arne@vajhoej.dk> - 2014-07-01 21:56 -0400
  Re: are lambdas a way to bring functional programming to java? Joerg Meier <joergmmeier@arcor.de> - 2014-06-28 12:11 +0200
    Re: are lambdas a way to bring functional programming to java? Roedy Green <see_website@mindprod.com.invalid> - 2014-06-30 08:50 -0700
      Re: are lambdas a way to bring functional programming to java? markspace <markspace@nospam.nospam> - 2014-06-30 09:09 -0700
      Re: are lambdas a way to bring functional programming to java? Wanja Gayk <brixomatic@yahoo.com> - 2014-07-01 19:27 +0200
        Re: are lambdas a way to bring functional programming to java? Wanja Gayk <brixomatic@yahoo.com> - 2014-07-01 20:46 +0200
          Re: are lambdas a way to bring functional programming to java? Sebastian <news@seyweiler.dyndns.org> - 2014-07-01 21:52 +0200
            Re: are lambdas a way to bring functional programming to java? markspace <markspace@nospam.nospam> - 2014-07-01 14:11 -0700
              Re: are lambdas a way to bring functional programming to java? Jan Burse <janburse@fastmail.fm> - 2014-07-22 14:37 +0200
                Re: are lambdas a way to bring functional programming to java? markspace <markspace@nospam.nospam> - 2014-07-22 10:39 -0700
                Sidetrack on generics (WAS: Re: are lambdas a way to bring functional programming to java?) Daniele Futtorovic <da.futt.news@laposte.net> - 2014-07-22 20:48 +0200
                Re: Sidetrack on generics (WAS: Re: are lambdas a way to bring functional   programming to java?) Chris Riesbeck <Chris.Riesbeck@gmail.com> - 2014-07-23 12:01 -0500
      Re: are lambdas a way to bring functional programming to java? Arne Vajhøj <arne@vajhoej.dk> - 2014-07-01 21:50 -0400
  Re: are lambdas a way to bring functional programming to java? Roedy Green <see_website@mindprod.com.invalid> - 2014-07-22 04:40 -0700
  Re: are lambdas a way to bring functional programming to java? Roedy Green <see_website@mindprod.com.invalid> - 2014-07-28 09:45 -0700

csiph-web