Friday, November 11, 2011

HaXe and OCaml (and Racket ?)

(x-post from G+)


The more I look at HaXe as a hedge against the uncertainty in the Flash world, the more I like it. The only reason I've resisted promoting it in the workplace is the fact that the underlying toolchain (the compiler) is written in OCaml - a language I don't know and have never wanted to know, given that I have already spent the time to climb the Haskell learning curve.

The Adobe news this week made me reconsider, and I have been researching the OCaml language and ecosystem. It is not an inferior Haskell, and in many ways seems more practical. That fact that it has a stable bytecode format is really nice - especially when there are projects like this that translate the bytecode to Javascript: http://ocsigen.org/js_of_ocaml/

Then there is this LLVM language implementation tutorial that uses OCaml: http://llvm.org/docs/tutorial/OCamlLangImpl1.html

I've been shopping around for a new systems programming language to replace Java (if Java can be considered a systems programming language). The languages I like, Clojure and Erlang, are both tied to VMs and the languages I really-really like, Prolog and Scheme, are not - for me - good systems languages. OCaml feels like it could be the one.

I am using DrRacket (the Racket Scheme IDE) for more and more of my UI prototyping experiments and would hate to abandon that (especially since OCaml's default graphics library uses X11). So I am thinking about ways to bring OCaml into my DrRacket environment - either through the FFI or by hacking the bytecode->JS translator to emit Scheme instead.

I'm looking forward to getting my bytecode hacking mojo back !

Wednesday, July 20, 2011

ClojureScript

I just watched Rich Hickey's presentation of the new ClojureScript tool and was very impressed.

Having previously mused on the utility of translating Clojure to Javascript I'm glad that this has now become an official project.

I am still digesting the implications but my initial thoughts are that this can form the basis of the Clojure to Flash project that is still being scoped out. It appears that the ClojureScript compiler is written in Clojure and introduces a post-analysis intermediate representation that would make it easier to write backends for different targets.

Whether it would be easier to translate to ActionScript source or to AVM2 bytecode is a question. The bytecode route would hold out the promise of getting the ClojureScript compiler to actually run in the Flash player and allow a self-contained development environment.

ClojureScript may also allow a backend for Scheme - to write iPad apps via Gambit Scheme.

The wheels are turning...

Thursday, June 16, 2011

Update to status of Flash projects

Update to http://epistemologicalengineering.blogspot.com/2011/03/status-of-flash-projects.html

UPDATE - June 16, 2011 - I could not escape Flash. I'm finding that I actually need to resurrect and use the j2swf and (maybe j2avm) tools for a commercial project. I don't want to continue writing Java, so I might start adding new code in Clojure, or lift the whole thing up into a model and use code-generation. I'll write a new post when things are figured out.

Tuesday, March 29, 2011

Status of Flash Projects

UPDATE - June 16, 2011 - I could not escape Flash. I'm finding that I actually need to resurrect and use the j2swf and (maybe j2avm) tools for a commercial project. I don't want to continue writing Java, so I might start adding new code in Clojure, or lift the whole thing up into a model and use code-generation. I'll write a new post when things are figured out.

-----

It's time to make it official - I no longer believe that I will ever resume work on my Flash-related projects (JavaSWF and its successors j2avm and j2swf).

[redacted]

These days there are many, many open-source SWF libraries, so I do not feel that letting JavaSWF die is a loss.

I have made many friends as a result of my Flash projects, and I would like to thank everyone who encouraged me, gave me gigs, and heckled from the sidelines.

Tuesday, March 22, 2011

Ontology Driven Programs via Prolog Partial Evaluation

This is a quick post to let the world know that I am still alive and still coming up with crazy ideas that I have no time to execute.

My current personal project involves building a stack for ontology-driven development. The "architecture" looks something like this:


That is..

  • An interactive development environment built around a Prolog system (SWI) for reasoning with ontologies and building applications that use ontologies in their modeling layer.
  • A partial evaluator that can graph-reduce a particular Prolog query (or set of queries), theories and ontologies into an efficient procedural form that can be translated into Scheme or JavaScript.
At the moment I am totally occupied with the partial evaluator. I also plan to use it to generate non-ontology apps for the Mac and iOS (via Gambit Scheme).

Notice that I didn't mention Yaks in this post.

Thursday, June 17, 2010

Applescript Engine in Java

Why wasn't I told about this before ? Applescript is supported in Java (at least on Snow Leopard) !

I was going down a rat-hole researching how to use the OS X scripting architecture and Apple Events when I discovered this.

Going to use this to implement a Clojure REPL using OmniGraffle - poll the current diagram page for an unevaluated expression in a shape and respond by drawing shape(s) containing the result.

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;

public class Test {
    public static void main( String[] args ) throws ScriptException {        
        ScriptEngineManager mgr = new ScriptEngineManager();        
        
        ScriptEngine engine = mgr.getEngineByName("AppleScript");
        engine.eval( "tell application \"iTunes\" to play" );        
    }
}