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


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

Re: are lambdas a way to bring functional programming to java?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From markspace <markspace@nospam.nospam>
Newsgroups comp.lang.java.programmer
Subject Re: are lambdas a way to bring functional programming to java?
Date Tue, 01 Jul 2014 14:11:33 -0700
Organization A noiseless patient Spider
Lines 58
Message-ID <lov868$rb$1@dont-email.me> (permalink)
References <ead6a498-272d-4ddd-b509-031bb858e882@googlegroups.com> <hpbujmlvfktw$.gwo2lpti2hsy.dlg@40tude.net> <ch13r992v98u5tqu88i2banltkpsgvhjkr@4ax.com> <MPG.2e1d0dba27ee4d221@202.177.16.121> <MPG.2e1d2056334506bc22@202.177.16.121> <lov3h3$thm$1@news.albasani.net>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 8bit
Injection-Date Tue, 1 Jul 2014 21:11:36 +0000 (UTC)
Injection-Info mx05.eternal-september.org; posting-host="5aa64ebf9a53573f97c75abba936b0e2"; logging-data="875"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19wFBVk6fe4tFSPIOG/tnJpDHY50JFlVEE="
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0
In-Reply-To <lov3h3$thm$1@news.albasani.net>
Cancel-Lock sha1:AlKhKtbqzo4yeOJAkihIh7cHFTU=
Xref csiph.com comp.lang.java.programmer:28892

Show key headers only | View raw


On 7/1/2014 12:52 PM, Sebastian wrote:

 > it is not reasonable to say that "a lambda is just a terser
 > way to implement an instance of a one-use anonymous class" - except as a
 > first approximation that will serve you well in many circumstances.

Right.  It's often useful to think of them that way, but it isn't 
accurate.  I think it also might be a bad way to introduce lambdas for 
new programmers.  Old timers know what an anonymous inner class is. 
Newbies probably won't.  (Hint for Roedy and his website.)

 > Here‘s a source for this claim: Stuart Marks answer at
 > 
http://stackoverflow.com/questions/15221659/java-8-lambda-expression-and-first-class-values 

 >
 > from which I quote:
 >
 > <quote>
 > SNIP
 > ...Their behavior is essentially undefined...

This is rather inaccurate.  The *behavior* of lambdas is well defined. 
The *implementation* is left to the JVM.

According to the video that Wanja posted, a lambda is just a single 
invoke-dynamic byte code, plus all the types and arguments captured 
thereby.  That's both really well defined, and also not an inner class 
at all.

If I understand that same video correctly, the guts of the example 
lambda presented were implemented by a private static method on the 
"parent" class, not a separate inner class, and so would have no 
distinct type at all.


> As Brian Goetz has memorably put it (on lambda-dev):
> "Lambdas-are-functions opens doors. Lambdas-are-objects closes them."

Yeah, Brian Goetz has been emphasizing that the peculiarities of a 
lambda are for our benefit in the long run, in spite of criticism to the 
contrary.  That goes for the lambdas-aren't-classes thing as well as 
lambdas-aren't-closures as well.

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.)

I don't blame folks for being nervous about new stuff introduced into 
Java, but I'm hopeful that the lambda expert group did a more thorough 
job researching possible consequences than what we got with generics.

BTW, reifiable classes/types are on the list of things being looked at 
for Java 9.  Keep your fingers crossed.

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