tag:blogger.com,1999:blog-8405107760807432973.post4409028312241058369..comments2024-01-04T09:55:32.459-08:00Comments on Java Concurrency (&c): Small Language Changes for JDK7Jeremy Mansonhttp://www.blogger.com/profile/04241094734813086257noreply@blogger.comBlogger34125tag:blogger.com,1999:blog-8405107760807432973.post-61622083545811202932009-08-30T07:32:00.071-07:002009-08-30T07:32:00.071-07:00It's a long time ago I have been this little i...It's a long time ago I have been this little interested in a major version bump of Java. This is not innovation, it's inertia patching. <br />I'm seriously doubting whether we'll see a JDK8 with closures, and even if we will in 2012 or so, by then other languages will have moved even further ahead. No wonder Neal Gafter moved on.Casper Banghttps://www.blogger.com/profile/09493174484116672294noreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-66812943769890204752009-03-29T19:50:00.000-07:002009-03-29T19:50:00.000-07:0033! But it really isn't all that unusual.33! But it really isn't all that unusual.Jeremy Mansonhttps://www.blogger.com/profile/04241094734813086257noreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-31181576848886466392009-03-29T16:10:00.000-07:002009-03-29T16:10:00.000-07:0031 comments??? Wow! Not bad for a complete boff...31 comments??? Wow! Not bad for a complete boff like you..Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-14362589353880336952009-03-10T10:05:00.000-07:002009-03-10T10:05:00.000-07:00Oh yes, my favorite language change:Please nuke #$...Oh yes, my favorite language change:<BR/><BR/>Please nuke #$@! \u escape sequences, at least in comments. Comments? Really? Jeebus I hate the fact that comments can be interpreted as anything other than straight up literal characters.<BR/><BR/>\u is OK in String literals. Anywhere else, it's just a bad idea waiting to trip up the unwary.Brendenhttps://www.blogger.com/profile/05100239997768852027noreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-65211602021441884642009-03-02T17:26:00.000-08:002009-03-02T17:26:00.000-08:00@Kartik -- This is in scope for JSR-305. Whether ...@Kartik -- This is in scope for JSR-305. Whether it actually gets done by JDK7 is not something I can predict.Jeremy Mansonhttps://www.blogger.com/profile/04241094734813086257noreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-35768129098099564452009-03-02T17:14:00.000-08:002009-03-02T17:14:00.000-08:00Hi Jeremy,Do you think Nullable annotations is a e...Hi Jeremy,<BR/><BR/>Do you think Nullable annotations is a enhancement small enough to make i into JDK7?<BR/><BR/>Sample example could be<BR/><BR/>public void doFoo(@Nullable Bar bar) {<BR/>.....<BR/>}<BR/><BR/>This would mean that bar instance can potentially be null.<BR/><BR/>Similarly you could configure a method to return non null values by using @NotNull annotations or something like that.<Kartikhttps://www.blogger.com/profile/10963952885180352990noreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-79177839361795892712009-03-02T17:12:00.000-08:002009-03-02T17:12:00.000-08:00This comment has been removed by the author.Kartikhttps://www.blogger.com/profile/10963952885180352990noreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-45891478506734917442009-03-02T13:48:00.000-08:002009-03-02T13:48:00.000-08:00@Anonymous about "Automated Resource Blocks" what ...@Anonymous about "Automated Resource Blocks" what I tried to explain (and I haven't reached) is that newbies learning to program would not acquire (and neglected programmers will forget) are skills about free those disposable resources. <BR/><BR/>I see it every day, some neglected programmers do not free resources (and don't care about it) in languages that need it (like delphi).<BR/><BR/>That's flikxxihttps://www.blogger.com/profile/07136986325582743029noreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-70127168273361580392009-03-02T05:03:00.000-08:002009-03-02T05:03:00.000-08:00How about this :Function SomeFunName (BufferedRead...How about this :<BR/><BR/>Function SomeFunName (BufferedReader br) {<BR/><BR/> return br.readLine();<BR/><BR/>[ try :<BR/><BR/>//Error handling code<BR/><BR/>]<BR/>} <BR/><BR/><BR/><BR/><BR/><BR/>- Logically GeniusAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-69728159472295248292009-03-02T01:41:00.000-08:002009-03-02T01:41:00.000-08:00We are on the same page. Your "auto" is my "transi...We are on the same page. Your "auto" is my "transient". (Chosen because it's already a keyword and backwards compatible for this use.)<BR/><BR/>And thanks for the link - an interesting read. Professional as always, Josh was nice enough to mention this alternative in his proposal:<BR/><BR/>"*Modifier in place of block* - An alterative to a block construct is a new modifier that could be added to sicklittlemonkeyhttps://www.blogger.com/profile/04832053874309101904noreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-36356910723185321962009-03-02T00:47:00.000-08:002009-03-02T00:47:00.000-08:00@nick -- Oh, and at the risk of revealing too much...@nick -- Oh, and at the risk of revealing too much about what I think, I agree with you about wanting locals with destructors. That's why I think that this shouldn't really have anything to do with closures -- it really has more to do with a given variable and its scope than it has to do with a block of code. In fact, my counterproposal to Josh was to introduce a new keyword at variable Jeremy Mansonhttps://www.blogger.com/profile/04241094734813086257noreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-17913837202640483742009-03-02T00:42:00.000-08:002009-03-02T00:42:00.000-08:00@nick - nope. This is a whole new proposal from J...@nick - nope. This is a whole new proposal from Josh. The whole thing can be found <A HREF="http://mail.openjdk.java.net/pipermail/coin-dev/2009-February/000011.html" REL="nofollow">here</A>.Jeremy Mansonhttps://www.blogger.com/profile/04241094734813086257noreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-37139335291364901172009-03-02T00:26:00.000-08:002009-03-02T00:26:00.000-08:00Thanks for the reminder Jeremy. I last looked at t...Thanks for the reminder Jeremy. I last looked at this a year ago. But each resource has to be the same type, right?<BR/><BR/>Basically, what I want for xmas is to be able to pretend that I have locals with destructors. I'm not ashamed to admit that. ;-)<BR/><BR/>There is too much boilerplate try/catching in Java code. Adding a keyword would really collapse things down.<BR/><BR/>Scoping could be sicklittlemonkeyhttps://www.blogger.com/profile/04832053874309101904noreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-88012988685183062642009-03-01T21:11:00.000-08:002009-03-01T21:11:00.000-08:00@sicklittlemonkey -- Actually, the syntax in the p...@sicklittlemonkey -- Actually, the syntax in the proposal allows for multiple resources. I just didn't want to dump the entire proposal into the blog entry. It looks like this:<BR/><BR/>try (ResourceClass r1 = new ResourceClass();<BR/> ResourceClass2 r2 = new ResourceClass2()<BR/> // and so on...<BR/> ) {<BR/> // do stuff with r1 and r2...<BR/>}Jeremy Mansonhttps://www.blogger.com/profile/04241094734813086257noreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-57569874006290773402009-03-01T20:59:00.000-08:002009-03-01T20:59:00.000-08:00For automated resource blocks the try {} notation ...For automated resource blocks the try {} notation still a bit verbose for common cases. It only allows one resource (like C#'s syntax).<BR/><BR/>A keyword would be more concise:<BR/>transient BufferedReader = null;<BR/><BR/>Cheers,<BR/>Nick.sicklittlemonkeyhttps://www.blogger.com/profile/04832053874309101904noreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-42133456967197271442009-03-01T20:20:00.000-08:002009-03-01T20:20:00.000-08:00String in switch statements: Why not? In fact, why...String in switch statements: Why not? In fact, why not objects of any arbitrary type? Even if it doesn't offer any performance improvements, a simple desugaring to if-then-else would be useful.<BR/><BR/>ARM block: Yes! The example of what we have to write today doesn't even tell the whole story. The fully proper code to write is<BR/><BR/>BufferedReader = null;<BR/>try {<BR/> br = new Greg Dennishttps://www.blogger.com/profile/16706523461822976947noreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-59476427069667208012009-03-01T19:58:00.000-08:002009-03-01T19:58:00.000-08:00@Anonymous - it's not pure crap. In C# 4, the usag...@Anonymous - it's not pure crap. In C# 4, the usages of "in" and "out" referenced are related to variance not pass-by-value vs pass-by-reference. Gafter's proposal is to use the same notation, albeit at each usage site instead of at the definition site, as a convenient mnemonic to understand and remember when it's useful to use ? extends Foo vs ? super Foo. For a better explanation of variance James Iryhttps://www.blogger.com/profile/02835376424060382389noreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-60681523752014351832009-03-01T19:38:00.000-08:002009-03-01T19:38:00.000-08:00Two language enhancements I would really like to s...Two language enhancements I would really like to see are 1: multi-line strings and 2: easy-to-create exception classes. They're not popular, they're just my peeves.konberghttps://www.blogger.com/profile/04616226121996611123noreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-52393571486223498772009-03-01T14:34:00.000-08:002009-03-01T14:34:00.000-08:00Neal's IN and OUT enhancement should be definitely...Neal's IN and OUT enhancement should be definitely be forgotten. Those in/out parameters mean nothing in Java. C# has a reference vs. value notation. Who says an "in" parameter can't be written to? It's pure crap.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-69023948930662164902009-03-01T13:58:00.000-08:002009-03-01T13:58:00.000-08:00FWIW I'm the guy who started WBJUS and it wasn't m...FWIW I'm the guy who started WBJUS and it wasn't me who posted the first comment. :)<BR/><BR/>Whether Martin wants people to switch to Scala in droves is immaterial--people are switching <EM>from</EM> Java and Sun appears to have no credible vision for how to keep us around. <BR/><BR/>JavaFX and Fortress are both pretty nice languages, but neither of them is making any attempt at the Alex Cruisehttps://www.blogger.com/profile/17293235415939008462noreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-69888108725168707762009-03-01T13:14:00.000-08:002009-03-01T13:14:00.000-08:00I'd prefer "type inference" similar ...I'd prefer "type inference" similar to C#'s:<BR/><BR/>var anagrams = new HashMap<String, List<String>>();Anonymoushttps://www.blogger.com/profile/00060140324205560525noreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-86187923764491631802009-03-01T11:12:00.000-08:002009-03-01T11:12:00.000-08:00I like the following changes1.) the resource block...I like the following changes<BR/>1.) the resource block<BR/>2.) multi catch<BR/>3.) new syntax for wildcards<BR/><BR/>My only concern with the resource block is that it could be implemented with closures - if we get them in java 8 that is. Other languages such as C# provide a "using" block and closures. I am not sure if they had their time they would only go with one approach and not both.unibrowhttps://www.blogger.com/profile/07904719300519725492noreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-49395569334753533632009-03-01T09:30:00.000-08:002009-03-01T09:30:00.000-08:00@franci:>Automated Resource Blocks, it's ve...@franci:<BR/>>Automated Resource Blocks, it's very useful in order to reduce boilerplate, but again newbies are in risk of forgetting to free resources.<BR/><BR/>the whole point of the ARM lang. change is to eliminate the "risk of forgetting to free resources". when using the new syntax you won't need to close the resource - that will be done for you automatically (hence the Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-79074982895368462742009-03-01T08:54:00.000-08:002009-03-01T08:54:00.000-08:00Hi Jeremy,this is what I think about these things:...Hi Jeremy,<BR/><BR/>this is what I think about these things:<BR/><BR/>Exception handling improvements would be great and very helpful for some algorithms, no doubts about this, I love it.<BR/><BR/>Improved Type Inference would be helpful for reading code, no doubts about this, I love it too.<BR/><BR/>Strings in Switch, maybe useful in some cases but not much and newbies are in risk of misusing itflikxxihttps://www.blogger.com/profile/07136986325582743029noreply@blogger.comtag:blogger.com,1999:blog-8405107760807432973.post-92202759368045075042009-03-01T07:23:00.000-08:002009-03-01T07:23:00.000-08:00Jeremy and Martin - thanks a lot for responses. I ...Jeremy and Martin - thanks a lot for responses. I wasn't sure what it was about before I looked at the google-doc. I see now it's just syntactic sugar over wildcards.Yardenahttps://www.blogger.com/profile/15649241856669571499noreply@blogger.com