Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #7791
| From | Tom Anderson <twic@urchin.earth.li> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: new Java lambda syntax |
| Date | 2011-09-11 13:06 +0100 |
| Organization | Eindhoven University of Technology |
| Message-ID | <alpine.DEB.2.00.1109111255530.13018@urchin.earth.li> (permalink) |
| References | <j4b80q$u30$1@dont-email.me> <alpine.DEB.2.00.1109101445260.18967@urchin.earth.li> <llbsj8-b59.ln1@news.simpsonst.f2s.com> |
On Sat, 10 Sep 2011, Steven Simpson wrote: > On 10/09/11 14:48, Tom Anderson wrote: > >> Did all that appalling lambda-transparency Gafterist nonsense get >> ditched or enshrined? > > My understanding is that the problem scope has been gradually whittled > down to 'potentially concurrent' APIs, i.e. where a method's contract > does not make the guarantee that all calls to a supplied lambda will be > on the method caller's thread, or that they will all finish before the > method call returns. These are the sorts of guarantees you'd need to do > control abstraction or event-driven coding, which in turn need the extra > transparencies. Yes - that sounds very sensible. It gives you lambdas that are as robust as objects, in terms of being used from multiple threads and so on, which is a good thing. Having lambdas have weaker guarantees would have introduced a second, parallel, set of rules which programmers would have had to learn, which would have been a bad thing. I'm surprised to hear (by implication) that 'non-potentially concurrent' semantics were even considered. Assuming i'm understanding you correctly. > I think the only transparencies that exist now are: > > * 'effectively final' - A non-final local variable can be immutably > captured by a lambda, so long as it's shown not to be assigned to > subsequently. Seems sensible. I would have been happy with a requirement for explicit finality, but i recognise that many people would have been annoyed by it, and i don't think this introduces any danger. Any idea how hard it is for the compiler to prove that the variable cannot be modified? > * 'long this' - In the body of a lambda, 'this' has the same meaning > as it would in the enclosing scope. It does not refer to the > object that ultimately fulfils the lambda. Also seems sensible. Are there any cases where you would want to refer to the lambda object itself? I'm sure people will come up with them once lambdas come into use. Will there be any way to get hold of such a reference? > * 'throws T' - A set of exceptions can be expressed as a generic > type parameter, so they can be relayed from the lambda's signature > to the signature of the method that calls it. Oh, cool. > There's no mutable local capture, Good. > or long jumps (break, continue, return, throw). Good! That was the thing i disliked most. > I'd like to have seen such things, but I've come to agree that they > shouldn't exist generally in lambdas. This seems to be a chararacteristic of the birth of lambdas in Java. Everyone started out passionately wanting different things, but we've been worn down into more or less agreeing on something. > It could be argued that these restrictions seem to reduce lambdas to > just a shorter syntax for certain anonymous inner classes. However, I > think there's an aspiration to implement them more cheaply than normal > objects. I'd be happy with them actually being syntactic sugar for anonymous classes (i am quite unsophisticated my tastes!). The VM boffins could then focus on making anonymous classes cheaper in general. >> Did that weird stuff about automatic conversion to single-method interfaces >> make it through? > > There are no automatically generated families of function types (yet), > so you have to rely on SAM (single abstract method) types. Lambdas are > just a syntactic construct until you've expressed or implied the SAM > type, with an assignment, initialization or a cast. Oh, wait, what? Wow. There's no function type? So you can *only* use lambdas as SAMs? Have i understood that correctly? That's kinky. You say 'yet' - can we expect function types before it's finished? tom -- the themes of time-travel, dreams, madness, and destiny are inextricably confused
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
new Java lambda syntax markspace <-@.> - 2011-09-08 13:19 -0700
Re: new Java lambda syntax Roedy Green <see_website@mindprod.com.invalid> - 2011-09-08 15:18 -0700
Re: new Java lambda syntax Arne Vajhøj <arne@vajhoej.dk> - 2011-09-08 18:27 -0400
Re: new Java lambda syntax BGB <cr88192@hotmail.com> - 2011-09-08 15:40 -0700
Re: new Java lambda syntax Arne Vajhøj <arne@vajhoej.dk> - 2011-09-08 19:27 -0400
Re: new Java lambda syntax BGB <cr88192@hotmail.com> - 2011-09-08 16:29 -0700
Re: new Java lambda syntax Arne Vajhøj <arne@vajhoej.dk> - 2011-09-08 19:48 -0400
Re: new Java lambda syntax Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-09-08 17:56 -0700
Re: new Java lambda syntax BGB <cr88192@hotmail.com> - 2011-09-08 22:23 -0700
Re: new Java lambda syntax "Nasser M. Abbasi" <nma@12000.org> - 2011-09-08 16:41 -0700
Re: new Java lambda syntax Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-09-08 20:50 -0500
Re: new Java lambda syntax bugbear <bugbear@trim_papermule.co.uk_trim> - 2011-09-09 09:33 +0100
Re: new Java lambda syntax Tom Anderson <twic@urchin.earth.li> - 2011-09-10 14:48 +0100
Re: new Java lambda syntax Steven Simpson <ss@domain.invalid> - 2011-09-10 16:17 +0100
Re: new Java lambda syntax Tom Anderson <twic@urchin.earth.li> - 2011-09-11 13:06 +0100
Re: new Java lambda syntax Steven Simpson <ss@domain.invalid> - 2011-09-11 17:18 +0100
Re: new Java lambda syntax BGB <cr88192@hotmail.com> - 2011-09-11 11:08 -0700
Re: new Java lambda syntax Steven Simpson <ss@domain.invalid> - 2011-09-11 20:14 +0100
Re: new Java lambda syntax BGB <cr88192@hotmail.com> - 2011-09-11 14:08 -0700
Re: new Java lambda syntax Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-09-11 17:07 -0500
Re: new Java lambda syntax BGB <cr88192@hotmail.com> - 2011-09-11 16:18 -0700
Re: new Java lambda syntax Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2011-09-13 02:00 +0200
Re: new Java lambda syntax Arne Vajhøj <arne@vajhoej.dk> - 2011-09-12 20:59 -0400
Re: new Java lambda syntax Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-09-12 21:24 -0500
Re: new Java lambda syntax Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2011-09-13 21:04 +0200
Re: new Java lambda syntax Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-09-13 15:22 -0500
Re: new Java lambda syntax Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2011-09-13 23:25 +0200
Re: new Java lambda syntax Tom Anderson <twic@urchin.earth.li> - 2011-09-13 21:29 +0100
Re: new Java lambda syntax Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2011-09-13 23:26 +0200
Re: new Java lambda syntax supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-09-13 20:25 -0400
Re: new Java lambda syntax Tom Anderson <twic@urchin.earth.li> - 2011-09-15 21:58 +0100
Re: new Java lambda syntax Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-09-13 21:36 -0500
Re: new Java lambda syntax supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-09-13 22:49 -0400
Re: new Java lambda syntax "supercalifragilisticexpialadiamaticonormalizeringelimatisticantations" <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-09-14 02:49 -0400
Re: new Java lambda syntax supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-09-14 03:01 -0400
Re: new Java lambda syntax "winkleMeister" <..00@00.00.00.1> - 2011-09-14 09:59 +0000
Re: new Java lambda syntax supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-09-15 10:16 -0400
Re: new Java lambda syntax supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-09-14 06:40 -0400
Re: new Java lambda syntax supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-09-15 10:16 -0400
Re: new Java lambda syntax lightworker <etts@0n.org.null> - 2011-09-16 01:57 +0000
Re: new Java lambda syntax thoolen <th00len@th0lenbot.thorium> - 2011-09-15 22:41 -0400
Re: new Java lambda syntax Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-09-14 06:29 -0300
Re: new Java lambda syntax BGB <cr88192@hotmail.com> - 2011-09-14 07:40 -0700
Re: new Java lambda syntax Lew <lewbloch@gmail.com> - 2011-09-14 08:01 -0700
Re: new Java lambda syntax BGB <cr88192@hotmail.com> - 2011-09-14 14:50 -0700
Re: new Java lambda syntax Lew <lewbloch@gmail.com> - 2011-09-14 18:02 -0700
Re: new Java lambda syntax BGB <cr88192@hotmail.com> - 2011-09-14 21:08 -0700
csiph-web