

Outlet: new Lisp that compiles js/lua with eval and debugging - jlongster
http://jlongster.com/2012/02/16/new-features-in-outlet.html

======
Arelius
I'm actually pretty interested in this, about to start a new project using
webGL. Two questions:

How predictable is the output JavaScript. This is important of optimization,
if I find that something is transforming improperly, I need to be able to
change that.

How is DOM and native JS Interop? I need to be able to trivially call WebGL
and do DOM manipulations, and perhaps anything else that can come up.

Examples will be appreciated.

~~~
jlongster
Thanks!

* The output is pretty robust. Everything compiles down to just a few basic forms: an atom, a function, lambda, and "if". I'm considering adding a form that lets you output raw JS if you need to optimize something, but I have yet to see the need for that.

* Outlet doesn't do anything crazy like CPS. When you call a function "foo" with "(foo 1 2 3)" it generators a simple function call "foo(1, 2, 3)". So you can call native javascript functions normally.

You can use arrays and objects inline, like so:

(define a [1 2 3 4])

(define b {:key "value" :another-key "value2"})

Those get generated to normal javascript arrays and objects, so you can pass
them as parameters to a native js function if needed.

You can even reference objects with "." like:

(define foo {:one 1 :two 2})

(print foo.one)

That works as expected. The only difference is vector reference, instead of
"foo[1]" you would do "(vector-ref foo 1)".

Of course, this is all subject to change, but the goal of Outlet is to not do
something crazy and for things to work as expected.

~~~
Arelius
Fantastic, thanks!

I assume you're familiar with parenscript. What are your thoughts on that?

I additionally love the ability to generate lua, I could see that being very
useful.

~~~
jlongster
Parenscript looks neat! I'm blatantly starting a new project because I feel
like I can only materialize my vision if its built from the ground up. Think
of it more as a research project at this point (though it works well). It
would take too long to change existing projects (but who knows, I might be
doing that in the future).

My main complaint about Parenscript is it's too Javascript inspired. I don't
want the "return" statement. Parenscript also seems to have no interest in
compiling out to other languages, like Lua.

------
semisight
Cool stuff. What are the major differences between this and clojurescript?

~~~
jlongster
I don't think ClojureScript has eval. Outlet will also provide more powerful
macros than defmacro. Outlet will also provide sophisticated debugging and
introspection tools within the browser. Lastly, Outlet will compile to Lua and
be able to run as a native app.

The primary goal of Outlet is to develop games, so it will be fast and
portable.

ClojureScript has different goals, and is primarily meant as an extension of
Clojure.

~~~
swannodette
ClojureScript is not primarily an extension of Clojure - it is an
implementation of Clojure. You can also expect the following from
ClojureScript in future:

* sophisticated debugging, introspection layer (in browser would be possible)

* fast, portable

You should be able to develop games as easily in ClojureScript as you would in
Outlet.

That said, Outlet is very cool!

~~~
jlongster
Fair enough. I heard Rich Hickey (I think) refer to as extending Clojure into
the browser, which made me think of it as an "extension" rather than a full
implementation. If the goal is a full implementation, that's awesome.

I'm really interested to watch ClojureScript develop, and it already has an
amazing community (and surprising awareness among devs). I probably need to
hack on the source before I make assumptions about it.

I'm enjoying the freedom of building a new language though, and things like
compiling to Lua and debugging aren't as nearly overwhelming because I'm doing
it from the ground up. Who knows though, if I get comfortable with
ClojureScript I could eventually just contribute to that.

~~~
swannodette
Don't get me wrong, I'm following the development of Outlet very eagerly and I
look forward to the games people build with it! Your earlier work with
iOS+Scheme inspired me to stick with my own Lisp endeavors :)

~~~
jlongster
Oh, you've seen that? Cool! The iOS stuff was fun. Thanks for watching :)

