;;;; A macro in an imported package. ;;;; ;;;; This used to be the refusal's test. The refusal said that collecting a ;;;; package's macros would need that package's imports resolved at the Form ;;;; level before [Load] ran -- a second import resolver. What it did not ;;;; notice is that the *file being compiled* is parsed before [Load] runs too, ;;;; so no shape of the feature could have left import resolution where it was. ;;;; [Load.program] takes forms now: it reads the import forms, resolves them ;;;; with the one resolver it always had, and parses the file with the ;;;; packages' macros in front of it. ;;;; ;;;; The rule is the one every other declaration follows. (mac/twice 4) is a ;;;; call and (twice 4) is an unknown name -- see the refusal beside this one ;;;; in test_acceptance.ml. (import mac "pkgs/mac") ;; A macro of the program's own, coexisting with the package's. (defmacro tenfold [args] `(* ~(at args 0) 10)) (defn show [n i32] () (print n) (println "")) (defn main [] i32 (show (mac/twice 4)) ; 8 (show (mac/quad 3)) ; 12 (show (mac/doubled 5)) ; 10 (show (mac/also-twice 6)) ; 12 (show (mac/shadowed 9)) ; 10 (show (mac/quadruple 2)) ; 8 (show (tenfold 7)) ; 70 ;; The program's macro over the package's, and the package's over a prelude ;; one: all three sets are in the same module and the walk is bottom up. (show (tenfold (mac/twice 3))) ; 60 0)