The Urn Logo

Version 0.4.3 released

Well, I think you should ring your friend and gather the family for this special occasion. Yes: it’s another Urn update! And, once again, there is plenty to excite you (well, as long as you’re a cephalopod with a passion for compilers).

Magic function generation

On previous versions of Urn, we had this ugly mess of definitions for car and cdr compositions. Thanks to the power of compile-time code generation, we can replace 60 definitions with 17 simple lines. This has massively reduced duplication, and helps showcase a neat feature of the language!

Codegen improvements

As I’ve talked about many times before, Urn tries to generate the nicest and most efficient Lua code possible. However, due to the nature of Lisp (and some design choices we made for Urn), this isn’t always easy. Thankfully the last few releases have made significant improvements, and this one is no exception.

First off: we try to merge multiple local declarations into one. For instance:

(let [(a (abc))
      (b (xyz))]
  (print! a b))

would get compiled into:

local a, b = abc(), xyz()
print1(a, b)

As this is only a codegen improvement, it won’t merge assignments from different let/let* blocks. This is something I hope to address in the future.

We’ve also taught the compiler to understand operator precedence. Before Urn would play safe and wrap everything in brackets to ensure operator order was conserved. Urn now understands how Lua parses it, and so only needs to insert brackets where appropriate. This makes for a much more readable source!