Duby also supports limited closures now; they'll eventually be full-on
closures, most likely with immutable closed-over variables (unlike
Ruby's mutable closed-over vars):

import java.util.Collections
import java.util.ArrayList

list = ArrayList.new [9,5,2,6,8,5,0,3,6,1,8,3,6,4,7,5,0,8,5,6,7,2,3]
puts "unsorted: #{list}"
Collections.sort(list) {|a,b| Integer(a).compareTo(b)}
puts "sorted:   #{list}"

It's worth noting that Duby compiles this into three class files with
no external dependencies, unlike the other JVM languages which carry
along their runtime libraries for all compiled code.

~/projects/duby ➔ bin/dubyc examples/sort_closure.duby

~/projects/duby ➔ ls examples/*.class
examples/SortClosure$__xform_tmp_1.class        examples/SortClosure.class
examples/SortClosure$__xform_tmp_2.class

~/projects/duby ➔ java examples.SortClosure
unsorted: [9, 5, 2, 6, 8, 5, 0, 3, 6, 1, 8, 3, 6, 4, 7, 5, 0, 8, 5, 6,
7, 2, 3]
sorted:   [0, 0, 1, 2, 2, 3, 3, 3, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 8,
8, 8, 9]

It has always been my intention to support simple closures in Duby
without introducing a runtime library, and I'll take that goal as far
as possible.

On May 13, 6:33 am, Kevin Wright <[email protected]>
wrote:
> Have you considered alternative JVM languages that give you access to the
> full java ecosystem but still have all that juicy functional goodness?
>
> I have a vested interest in Scala, but Groovy, Clojure, etc. are also
> looking good nowadays.  Definitely worth checking out!
>
> On 13 May 2010 01:06, RogerV <[email protected]> wrote:
>
>
>
>
>
> > Closures in Java 7: Not Likely
> >http://www.davidflanagan.com/2010/05/closures-in-jav.html
>
> > Anybody on this list have any insight to what's going on at Oracle
> > regarding Java?
>
> > Is this article an over reaction or spot on?
>
> > I have to admit am starting to get worried about Oracle's stewardship
> > of Java. They need to be making a public perception that they're on
> > top and on the ball with prior stated goals for the language. Yet it's
> > more like they've all gone on holiday and turned the lights out.
>
> > The sad thing in my case is I was on the verge of getting a
> > development group that's been using C# .NET for a few years to switch
> > to Java and an app server to do the re-tooling of their app. (This is
> > not at all a web centric application and a JEE app server actually
> > would have a ton of advantages for their particular middle-ware. This
> > is very much of a case of the plethora of libraries and frameworks per
> > Java platform would be much greater advantage than the latest C#
> > language feature set.)
>
> > Yet if Java is just slipping into the depths of language atrophy, as
> > alluded to by this linked posting, then that makes for a tougher sell.
> > If I could at least have said "see, you'll be getting closures in Java
> > 7 real soon now..."
>
> > C# has closures and lambdas now and once you start using those
> > facilities you get spoiled to them. My very sold reasons for wanting
> > them to switch has to contend with these kinds of nits - despite these
> > things are not as crucial as the Java Concurrency library or the fork/
> > join framework, or cluster singleton mbeans, etc., etc.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "The Java Posse" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<javaposse%2bunsubscr...@googlegroups 
> > .com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/javaposse?hl=en.
>
> --
> Kevin Wright
>
> mail/google talk: [email protected]
> wave: [email protected]
> skype: kev.lee.wright
> twitter: @thecoda
>
> --
> You received this message because you are subscribed to the Google Groups 
> "The Java Posse" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group 
> athttp://groups.google.com/group/javaposse?hl=en.

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to