ra’s avatarra’s Twitter Archive—№ 45,808

      1. sentimental thread on the arc of work that would become the MAGIC compiler. forgive me, i am a ham when it comes to this stuff. i love that it is all encoded in publicly accessible timestamped urls and that i can look back on a life lived in computers.
    1. …in reply to @ra
      the arcadia project starts april 17 2014 with this commit. while at @ktcoders @timsgardner and i wanted to livecode games in unity and we found that if you did a bit of work you could get a whole ass clojure compiler in there! github.com/arcadia-unity/Arcadia/commit/c0207892457ad35c00b6ccadae2965dc71ad0be4
  1. …in reply to @ra
    a little less than a year into the project i had spent a bunch of time hacking on @dmiller2718's implementation (github.com/clojure/clojure-clr). it inspired me to start playing around with bytecode emission on my own, and this gist is my first working sketch gist.github.com/nasser/5a962c9d981b8b38300e
    1. …in reply to @ra
      that was just direct interop to the C# methods, nothing fancy. it was out of conversations with @kovasb about his gamma library (github.com/kovasb/gamma) that i designed the beginnings of my functional emission library MAGE a few months later. gist.github.com/nasser/0d73863b36fc4f23dc3c
      1. …in reply to @ra
        a few weeks later that gist became the first commit to the MAGE repository github.com/nasser/mage/commit/f369afed931c7746a228cb70979abc16193ebf05. that is the repo that still underpins MAGIC and its architecture is largely unchanged! it has grown a lot and acquired new powers, but the same basic ideas from the gist are there.
        1. …in reply to @ra
          a few months later, with a functional emission library in hand, i started MAGIC itself github.com/nasser/magic/commit/edbfc5d0d75771ed0586a766bf676a79d54f5a2c. 406 commits later and 5ish years later MAGIC is a little over halfway to self-hosting.
          1. …in reply to @ra
            MAGIC has changed a lot compared to MAGE. the original commit used the stock ClojureCLR analyzer, the current cut uses @Bronsa_'s tools.analyzer library plus our own passes.
            1. …in reply to @ra
              MAGIC's dispatch was originally done through a static map, then it was through multimethods, and finally through a compiler map threaded through the compilation. this approach has made fine grained customization of bytecode in different contexts straightforward to reason about!
              1. …in reply to @ra
                along the way a lot of tooling was built! in 2016 a year into MAGIC i built the nostrand REPL (github.com/nasser/nostrand/commit/4c460fe5b5f4592b9d5d3109fe1618a8d01612e9) and the illness disassembler (github.com/nasser/illness/commit/f0bb0c8356743af256e62fdc43f4e14354771cae). i use both of these tools ever single day to build MAGIC.
                1. …in reply to @ra
                  this stuff is probably what ive talked about the most at programming conferences! @strangeloop_stl, @Clojurewest, @LispNYC, and @softwaregr were all kind enough to host me a while i nerded out about bytecode! i collect them all at nas.sr/talks/
                  1. …in reply to @ra
                    anyway, this compiler is closer to completion than i ever thought possible. i have learned so damned much in five years from such wonderful people and i am grateful for this whole experience. just had me having Feelings and looking at old code and i thought i'd share ♥️