4 ms·
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
by Arelius 15y ago
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 15y agoThanks! * 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 15y agoFantastic, 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 15y agoParenscript 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.