jaunt-lang / jaunt

[ABANDONED] A jaunt away from Clojure
https://github.com/jaunt-lang/jaunt/issues/157
134 stars 6 forks source link

Implement meaningful fn metadata #129

Closed arrdem closed 8 years ago

arrdem commented 8 years ago

This changeset tweaks the compiler to emit introspectable Var use set and arity information on Fns.

At present, a Fn can have the following metadata:

Other metadata may be added in the future given more consideration.

2016-04-06-170102_952x702_scrot

Fixes #127

Thanks to @mikera for some prior art on this matter, and RFC on this implementation.

arrdem commented 8 years ago

@Bronsa points out that, as presently implemented, calling withMeta on AFn will return a new anonymous AFn which masks all methods and uses applyTo for everything. This means that putting metadata on the Fn itself is a pretty crappy idea until fn* emission can be fixed to implement withMeta itself.

This is doable, in fact it should be a pretty simple copy/paste job from the implementation of reify* which must implement IObj in the code generator. However I'm seeing weird shit and think I may have broken AOT somehow so I'm gonna circle back to this another day.