Arc Forumnew | comments | leaders | submitlogin
Anarki is now a Racket #lang
6 points by rocketnia 2794 days ago | 5 comments
Hi! I just added a new feature to Anarki. Now you can write a Racket module like so:

  #lang anarki
  (:provide foo bar baz)
  
  ; Arc code
  (= foo 1)
  (= bar 2)
  (= baz 3)
The (:provide ...) line is neither Arc code nor Racket code. It's just a file header, the easiest syntax I could think of to let an Arc-based library have simple Racket exports. Note that at this point it only exports values, not syntaxes, so you can't write a macro in Arc and call it from Racket.[1] Also, Anarki programs still clobber one giant shared global scope, so this is really only for the benefit of letting Anarki modules blend in among a bunch of other Racket imports. If you have nothing in your Anarki module that you particularly want a Racket program to be able to (require ...), you can simply write (:provide) with no variables.

As a makeshift unit test, I've written a network of "hello world" modules in Anarki's lib/racket-lang-demo/ directory. They demonstrate how #lang racket modules, #lang anarki modules, and traditional Anarki files can all use a #lang anarki module and vice versa:

  racket-application.rkt
  lang-anarki-application.rkt
  plain-anarki-application.arc
  
    lang-anarki-library.rkt
  
      racket-deep-dependency.rkt
      lang-anarki-deep-dependency.rkt
      plain-anarki-deep-dependency.arc
I was studying how to make a Racket #lang, and this project seemed like a good way to give Arc something that it's been missing for a while. :)

---

[1] Using raw Arc macros from Racket would be a bit unsatisfying anyway. Arc macros expect their subexpressions to be Arc subexpressions, so the Racket program would have to use some kind of quasiquotation-like cruft to switch back to Racket syntaxes.



3 points by rocketnia 2791 days ago | link

Since I was delving into the Arc codebase and my Lathe codebase anyway, I made a bunch of fixes to Anarki, Anarki's stable branch, arc/nu's arc/3.1 language, and Rainbow.js today. It's enough to run a simple check of Lathe's module system on Windows, which meant I fixed a bunch of Windows bugs in particular! My Lathe sanity checks also worked fine on Rainbow, Jarc, ar, and the official Arc 3.1.

-----

5 points by rocketnia 2791 days ago | link

I've added Travis CI integration to Anarki, so now there's a badge in the readme which links to the latest unit test results.

I've fixed up news.arc enough for it to work on Windows, although I've only tested basic account creation, posting, and commenting.

Feeling pret-ty productive. It's been like seven years since I've done this much with Arc, but I suppose there's no time like the present. :)

-----

4 points by akkartik 2790 days ago | link

That is great! Welcome back :)

-----

3 points by rocketnia 2794 days ago | link

Here's a link to the commit. As you can see, I've heavily commented the implementation of the Racket macro that implements the module body syntax for #lang anarki modules:

https://github.com/arclanguage/anarki/commit/600ed95adf4e3ec...

-----

3 points by rocketnia 2794 days ago | link

I almost forgot to add the square bracket reader syntax. :)

https://github.com/arclanguage/anarki/commit/f9548c50ea6e7a9...

-----