Loop is like CoffeeScript?

39 views
Skip to first unread message

Ashwin Jayaprakash

unread,
Jul 17, 2012, 5:28:51 PM7/17/12
to loop...@googlegroups.com
Loop looks a lot like CoffeeScript (http://coffeescript.org/). It would be nice if Loop could support CoffeeScript and just compile to Java instead of JavaScript.

Coffee is quite popular in the HTML5/Web community.

Ashwin.

Dave Newton

unread,
Jul 17, 2012, 5:32:23 PM7/17/12
to loop...@googlegroups.com
On Tue, Jul 17, 2012 at 5:28 PM, Ashwin Jayaprakash <ashwin.ja...@gmail.com> wrote:
Loop looks a lot like CoffeeScript (http://coffeescript.org/). It would be nice if Loop could support CoffeeScript and just compile to Java instead of JavaScript.

I don't really see the similarity.

What would it mean for "Loop to support CoffeeScript", anyway?

Dave

Ashwin Jayaprakash

unread,
Jul 17, 2012, 6:15:46 PM7/17/12
to loop...@googlegroups.com
Well, Coffee is a more concise version of JavaScript. Loop (to me) looks like a more concise version of Java (among other things).

The syntax also looks very similar and Coffee has a good user base. Some things that jumped up when I looked at the docs of both:

Classes in Coffee:

class
Animal constructor: (@name) -> move: (meters) -> alert @name + " moved #{meters}m." class Snake extends Animal move: -> alert "Slithering..." super 5 class Horse extends Animal move: -> alert "Galloping..." super 45 sam = new Snake "Sammy the Python" tom = new Horse "Tommy the Palomino"


Classes in Loop:
class Star -> name mass
Coffee closures:
Account = (customer, cart) -> @customer = customer @cart = cart $('.shopping_cart').bind 'click', (event) => @customer.purchase @cart
new Star()

Loop closures:
main -> channel(@printer, print_message, {:}), @printer.send(i) for i in [1..10], @printer.send(-1)


Ashwin.

Dave Newton

unread,
Jul 17, 2012, 6:22:35 PM7/17/12
to loop...@googlegroups.com
Based on this there are many languages that look like Loop, then, I guess.

I guess I don't classify CoffeeScript and Loop in the same family of languages.

I don't really get the "Loop support CoffeeScript" part; Loop compiles to bytecode. Are you asking for another back-end that supports a different VM?

Dhanji R. Prasanna

unread,
Jul 17, 2012, 6:25:59 PM7/17/12
to loop...@googlegroups.com
Loop is functional like Lisp or Erlang (actually Loop borrows the '->' from erlang), so it would basically be a whole rewrite to change the semantics to understand coffeescript. If you want to borrow some of the tools from Loop to create a "CoffeeScript for Java" then go for it!

Dhanji.

Dave Newton

unread,
Jul 17, 2012, 6:28:18 PM7/17/12
to loop...@googlegroups.com
I think xtend [1] or mirah [2] would be the closest analogs.

Plus since CoffeeScript compiles to JavaScript, you can already run it on the JVM via Rhino.

Dave

ses

unread,
Jul 19, 2012, 4:30:55 AM7/19/12
to loop...@googlegroups.com
On Tuesday, 17 July 2012 22:28:51 UTC+1, Ashwin Jayaprakash wrote:
It would be nice if Loop could support CoffeeScript and just compile to Java instead of JavaScript.

In a sense, Loop itself does compile to Java as it runs on the JVM, it just does this at runtime, whereas AFAIK CoffeeScript is compiled to JavaScript prior to runtime. You can use compiled Loop programs from within Java if this is what you are after.
Reply all
Reply to author
Forward
0 new messages