I think you'll find that Scala has already beaten you to it!

As a language, it already supports many of your requested features, or the
ability to implement them via an internal DSL.


On 13 July 2010 00:41, Dibyendu Majumdar <[email protected]> wrote:

> Hi,
>
> I am thinking of creating a Google Go type language which can run on
> the JVM. The goal is to keep to the features supported efficiently in
> Java but (taking inspiration from Go), reduce the verbosity in the
> language, and perhaps add some concurrency features to the language.
>
> The key ideas that I would like to implement in the new language are:
> - static type inference (I am aware of the arguments for/against but
> on balance prefer to support this, while allowing explicit type
> declarations where needed).
> - channels - add syntactic support for creating either a synchronous
> or buffered queue (using standard Java concurrency library)
> - maps - syntactic support for hash maps
> - tasks - syntactic support for submitting tasks to a thread pool -
> using the concurrency library
> - convention over boilerplate  - like Go, if an identifier starts with
> a capital, make it automatically public, else private, and use similar
> techniques to reduce boilerplate stuff
> - static methods should not have to be declared in a class - to
> automatically create a default class per package to hold static
> methods - there may be better ways of doing this though.
>
> Features that I am not planning to implement:
> - Go interfaces
> - Ability to select on channels
> - Or any thing else that does not map directly to a feature in Java.
>
> To illustrate what inspires me to create this language, I am quoting
> below code from two simple programs, one in Go, another in Java. They
> are equivalent, but the Java version is much more verbose (which some
> people may like).
>
> I would like to know if anyone else here has looked at Go and is
> working on implementing such a language on the JVM. Also, as I am new
> to this, is there a language implementation that I could use as a
> starting point (I was looking at phpreboot for instance) for hacking.
>
> BTW, the Java version of the program below is 10 times faster than the
> Go version.
>
> Thanks and Regards
> Dibyendu
>
> ---------- Go version -------------
>
> func producer(c1 chan int, N int, s chan bool) {
>        for i := 0; i < N; i++ {
>                c1 <- i
>        }
>        s <- true
>
> }
>
> func consumer(c1 chan int, N int, s chan bool) {
>        for i := 0; i < N; i++ {
>                <-c1
>        }
>        s <- true
>
> }
>
> func unbufProdCons(N int) {
>        c1 := make(chan int)
>        s := make(chan bool)
>
>        go producer(c1, N, s)
>        go consumer(c1, N, s)
>
>        <-s
>        <-s
> }
>
> ----------- Java version ------------
>
>    static final class Producer implements Runnable {
>        final SynchronousQueue<Integer> c1;
>        final int N;
>        final SynchronousQueue<Boolean> s;
>
>        Producer(SynchronousQueue<Integer> c1, int N,
>                SynchronousQueue<Boolean> s) {
>            this.c1 = c1;
>            this.N = N;
>            this.s = s;
>        }
>
>        public void run() {
>            try {
>                for (int i = 0; i < N; i++) {
>                    c1.put(i);
>                }
>                s.put(true);
>            } catch (InterruptedException e) {
>                e.printStackTrace();
>                System.exit(1);
>            }
>        }
>    }
>
>    static final class Consumer implements Runnable {
>        final SynchronousQueue<Integer> c1;
>        final int N;
>        final SynchronousQueue<Boolean> s;
>
>        Consumer(SynchronousQueue<Integer> c1, int N,
>                SynchronousQueue<Boolean> s) {
>            this.c1 = c1;
>            this.N = N;
>            this.s = s;
>        }
>
>        public void run() {
>            try {
>                for (int i = 0; i < N; i++) {
>                    c1.take();
>                }
>                s.put(true);
>            } catch (InterruptedException e) {
>                e.printStackTrace();
>                System.exit(1);
>            }
>        }
>    }
>
>    public static void main(String args[]) throws Exception {
>        // warmup
>        SynchronousQueue<Integer> c1 = new
> SynchronousQueue<Integer>();
>        SynchronousQueue<Boolean> s = new SynchronousQueue<Boolean>();
>        final int N = 50;
>
>        Thread t1 = new Thread(new Producer(c1, N, s));
>        Thread t2 = new Thread(new Consumer(c1, N, s));
>        t1.start();
>        t2.start();
>
>        s.take();
>        s.take();
>        t1.join();
>        t2.join();
>    }
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "JVM Languages" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<jvm-languages%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/jvm-languages?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 "JVM 
Languages" 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/jvm-languages?hl=en.

Reply via email to