tag:blogger.com,1999:blog-6173836134826281546.post5400459095451605244..comments2024-03-23T03:18:50.166-07:00Comments on Zdeněk Troníček's blog: Local VariablesZdeněk Troníčekhttp://www.blogger.com/profile/12818559511505042249noreply@blogger.comBlogger10125tag:blogger.com,1999:blog-6173836134826281546.post-65805703415751906922017-02-15T09:56:35.132-08:002017-02-15T09:56:35.132-08:00plumbing company near me<a href="http://localplumberdirectory.com/residential-services" rel="nofollow">plumbing company near me</a>Paypercallhttps://www.blogger.com/profile/12515400110824762681noreply@blogger.comtag:blogger.com,1999:blog-6173836134826281546.post-24666015927863034892009-05-06T10:47:00.000-07:002009-05-06T10:47:00.000-07:00Hi Anirudh,
the Shared annotation was added later...Hi Anirudh,<br /><br />the Shared annotation was added later to the prototype. It is described in the <A HREF="http://tronicek.blogspot.com/2008/02/version-2008-02-22.html" REL="nofollow">version-2008-02-22</A> post.Zdeněk Troníčekhttps://www.blogger.com/profile/12818559511505042249noreply@blogger.comtag:blogger.com,1999:blog-6173836134826281546.post-76529154218355539772009-05-05T21:43:00.000-07:002009-05-05T21:43:00.000-07:00I compiled a simple closure code ... doing somethi...I compiled a simple closure code ... doing something with outside variable, <br />public final class SimpleClosure {<br /> <br />public static final void main(final String[] pArgs){<br /> // non final.<br /> int y = 4;<br /> {int => int} funClosure = {int x => ++y; x=x+y};<br />funClosure.invoke();<br />sysout("{" + funClosure.invoke() + "});<br /><br />However with this code, I get a warning:<br />warning: [shared] captured variable y not annotated @Shared,<br /><br />So I put on the annotation, Can this be reflected on the post ... Nice post! I am still a little confused on semicolon (where to put it ... etc). Will have to read up a little more I guess :)<br /><br />Regards<br />Vyas, AnirudhAnirudh Vyashttps://www.blogger.com/profile/15366409490581047766noreply@blogger.comtag:blogger.com,1999:blog-6173836134826281546.post-79137555987033736172008-06-13T06:27:00.000-07:002008-06-13T06:27:00.000-07:00Good Job! :)Good Job! :)Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6173836134826281546.post-71251297138270913822008-04-02T01:47:00.000-07:002008-04-02T01:47:00.000-07:00Hi,closures are implemented as anonymous inner cla...Hi,<BR/><BR/>closures are implemented as anonymous inner classes (see my post "Closures" from December 2007).Zdeněk Troníčekhttps://www.blogger.com/profile/12818559511505042249noreply@blogger.comtag:blogger.com,1999:blog-6173836134826281546.post-46538711098551124922008-04-01T21:31:00.000-07:002008-04-01T21:31:00.000-07:00How is closure implemented? I mean in context of t...How is closure implemented? I mean in context of types; are closures of different type? and how does Java handle the difference between the namings, a function type name and a method name ...( wont there be a namespace collision?)<BR/><BR/>Regards<BR/>Vyas, AnirudhAnirudh Vyashttps://www.blogger.com/profile/15366409490581047766noreply@blogger.comtag:blogger.com,1999:blog-6173836134826281546.post-15602410296659582902008-03-29T07:15:00.000-07:002008-03-29T07:15:00.000-07:00Hi Tim,Neal Gafter wrote me: "I think it makes sen...Hi Tim,<BR/><BR/>Neal Gafter wrote me: "I think it makes sense to give anonymous inner classes the same behavior as restricted closures."<BR/><BR/>So, you can forget about my previous comment :o).Zdeněk Troníčekhttps://www.blogger.com/profile/12818559511505042249noreply@blogger.comtag:blogger.com,1999:blog-6173836134826281546.post-20762132659531933342008-03-28T10:58:00.000-07:002008-03-28T10:58:00.000-07:00well, all the old code would still be compilable, ...well, all the old code would still be compilable, so this would be compatible. And why should inner classes not be able to use shared variables (@shared annotated)?<BR/><BR/>I don't found a word about that in neals blog, neither in yours, so i ask myself if this is change by fault or intentionally.Tim Büthehttps://www.blogger.com/profile/10237607035709620470noreply@blogger.comtag:blogger.com,1999:blog-6173836134826281546.post-984783465134695752008-03-28T10:22:00.000-07:002008-03-28T10:22:00.000-07:00Hi Tim,I do not expect this restriction will be dr...Hi Tim,<BR/><BR/>I do not expect this restriction will be dropped. Due to compatibility it should be preserved.Zdeněk Troníčekhttps://www.blogger.com/profile/12818559511505042249noreply@blogger.comtag:blogger.com,1999:blog-6173836134826281546.post-75266544784575500922008-03-27T04:48:00.000-07:002008-03-27T04:48:00.000-07:00Hi,you wrote In inner classes, you can access a va...Hi,<BR/><BR/>you wrote <I>In inner classes, you can access a variable from enclosing scope only if it is final. For closures, there is no such restriction</I><BR/><BR/>You are right, closures don't have this restriction and inner classes had it, but while playing around with the latest version (closures-2008-03-22) i realized that inner classes can access non-final variables also.<BR/><BR/>So what is this about? Will this restriction for inner classes be dropped? And if not, why can you get it right for closures and not for inner classes?<BR/><BR/>regards,<BR/>TimTim Büthehttps://www.blogger.com/profile/10237607035709620470noreply@blogger.com