pixie-lang/pixie — pull request #55 by heyLu (2014-11-10 10:25:23+00:00)
Title: Meta improvements, deftype and defrecord

Meta stuff:

* `^Symbol` now results in `{:tag Symbol}` being added to the metadata. Not used now, but likely in the future.
* `defn` now allows specifying a docstring and/or a map with meta information, for some reason, this breaks `run_interactive`, @halgari can you look into it?

`deftype` improvements and `defrecord`: probably easiest to have a look at the tests, here's a summary:

* `deftype`:
- you can specify fields as symbols now, e.g. `(deftype Three [one two three])`
- fields are made availlable to methods automatically (see `one-plus` below)
- "dot" property access: `(= (.one (->Three 1 2 3)) 1)`
- "dot" method calls:

```
(deftype Three [one two three] Object (one-plus [self & xs] (apply + one xs)))

(= (.one-plus (->Three 1 2 3) 4) 5)
```
- as you can see, you can now also add non-protocol methods to deftypes (`Object` is a placeholder for that, the methods are stored as fields in the deftype)
* `defrecord`: didn't plan to add it so soon, but it was fairly simple and is based on deftype

To support "dot" calls there is a tiny `macroexpand` function in the compiler now. For now it only handles the dot expressions.