Clojure Gazette 1.77

Quil in ClojureScript: Interview with Maksim Karandashov

Clojure Gazette

Issue 1.77May 25, 2014

Hi Clojure enthusiasts,

This week I'm happy to begin a series of interviews with the students participating in the Google Summer of Code.

Our first interview is with Максим Карандашов (Maksim Karandashov).

Clojure Gazette: Where are you from? Where do you go to school?

Maksim Karandashov: I'm from Saratov, Russia. I graduated from Saratov State University in 2012 and now I'm Ph. D. student in SSU. Specialize in automata theory.

CG: How did you get started with Clojure?

MK: The first time I learned about Clojure from article of Alex Ott in fprog.ru journal. That was in 2010. I have not used Java before (I have previously used F# and C#), but I was interested in Lisp like languages. The key for me was a combination of Lisp and support for large software platform.

CG: What project are you working on?

MK: I'm working on adding ClojureScript support to Quil library . Quil is a Clojure wrapper for popular Java library - Processing. Quil provided not only wrappers for Processing but also own mini DSL for sketches creation. You can start creating sketches on Clojure without any knowledge about Java GUI libraries.

And my job is to create the most compatible version of Quil for ClojureScript. So that people could easily transfer their experience in the browser and distribute them.

CG: It sounds like a great way to do games in the browser. What are the challenges you see ahead?

MK: I see two things that can cause trouble.

The first trouble is that current implementation of ClojureScript has some differences from the Clojure. This concerns the implementation of the macro and import symbols from the package. For example: In ClojureScript you can't use (require '[lib.name :refer :all]) or (use 'lib.name) but some users use these forms in own code. And I do not think someone will like to add in dozens of places library prefix when porting own code to ClojureScript.

The second task is that when porting is necessary to test each function of Quil. And this is complicated by the need to check it in different browsers and operating systems. This can be time consuming, but it is very important to make a really good library.

Other tasks, at least for now, do not seems to be difficult in terms of decision-making or in terms of time spent.

CG: Will Quil in ClojureScript use the Canvas API?

MK: Yes. Quil will be hosted on canvas element of web page and supported WebGL API for 3D rendering mode.

CG: What attracted you to the Quil in ClojureScript project?

MK: Complicated question. Probably a combination of interest in Clojure, old experiments with Processing (on Java and Scala) and opportunity to try something new (I have not used ClojureScript before, only JavaScript and Clojure with Java).

I really like the approach of Processing to creating computer graphics. It's simple and very clear. You do not need to know about the different concepts of creating graphics. Just a little math and you can start. It's probably one of the most important reasons why.

CG: One of the nice things about Processing is that it is interactive. It's great for beginners. You download it, open the app, and you can start coding and seeing the output immediately. Is there any plan to do something similar to avoid the difficulties with setting up ClojureScript builds?

MK: I will try to simplify the process of developing sketches. At the present moment all that is required from the developer it is 4 simple steps.

  1. Define sketch code;
  2. Add refers to output js file and to Processing.js in html page;
  3. Add call of sketch init function to page;
  4. Call lein compile for compiling cljs and cljx files to js code.

After that you can look at you page with sketch (of course you can add connection to browser repl to debugging and development).

How it can be simplified?

First, we can make Quil ClojureScript project template for Leiningen. This can simplify the process of creating a project from scratch.

Second, we can create app with Clojure, ClojureScript and so on for users. In clj-processing mailing list sounded the idea of creating Quil mode for Processing Development Environment and I think it's a good idea. Maybe it will be implemented after I complete porting Quil library (first working prototype will be made ​​within 1-2 weeks, and the beta version will be the end of June).

CG: It sounds like you've got good plans to get people started. If people are interested in following the progress of the project, where should they go?

MK: I will publish the results and plans in the mail list.

And I'll be posting news about new prototypes/beta versions in general mailing lists Clojure and ClojureScript.

CG: Is there anything else you'd like to say before the end of the interview?

MK: I definitely want to say thanks for Google. GSOC forcing thousands of people in this world to do useful things and it is excellent.

And I want to say thanks to all in Clojure community. Indeed, precisely because of its existence - Clojure is so well.

CG: Great! Thanks for a great interview and good luck with your project!

MK: Thanks Eric! It was an interesting experience for me.