Jason (jcreed) wrote,

I am caught between on the one hand (a) feeling that I really shouldn't be working on this nonsense, and (b) feeling strong nostalgic pleasant feelings for how I felt early on in college when hacking on ridiculous little things was the funnest thing one could do. I'll work on my stale old paper tomorrow, I promise. Y'all can make fun of me if I don't.

At least this is yielding me success in proportion to my effort, which is more than I can say for research lately.

Here is the latest result of my CPS-language-to-Javascript backend attempt: (which together with tom's front-and-middle-end basically constitutes a core-ML-to-Javascript compiler) It is now possible to write a glue function "install_function" such that running in Firefox the compilation of
    fun test (i) = let val x = alert(i) in 5 end
    install_function("test", test)

in fact creates a javascript function test, and if you call it from javascript-world with an argument, it will indeed pop up an alert window displaying that argument, and it will return 5 to javascript world. I'm not sure I've accounted fully for how closure conversion munges around calling conventions and stuff, but for the one-argument environment-ignoring case, it totally works. This means that one can (after some boilerplate is out of the way) basically write pure ML even for the higher-order parts of the DOM and user-interface APIs that require callbacks.
Tags: javascript

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded