basilisp-lang / basilisp

A Clojure-compatible(-ish) Lisp dialect targeting Python 3.8+
https://basilisp.readthedocs.io
Eclipse Public License 1.0
256 stars 6 forks source link

top level var macroexpansion #888

Closed ikappaki closed 7 months ago

ikappaki commented 7 months ago

Hi,

the top level macroexpansion of a var appears to be resolving it rather than returning the var.

To reproduce,

  1. open up a REPL and check the return value and the type of a macroexpanded var
    
    basilisp.user=> (var basilisp.core/inc)
    #'basilisp.core/inc

basilisp.user=> (type (eval (macroexpand '(var basilisp.core/inc)))) <class 'function'>


contrast with Clojure
``` clojure
user> (var clojure.core/inc)
#'clojure.core/inc
user> (type (eval (macroexpand '(var clojure.core/inc))))
clojure.lang.Var

I had a look at the analyzer/compiler, but I couldn't figured out how to correct it.

Thanks