diff options
Diffstat (limited to '')
-rw-r--r-- | documentation/research/database.md | 1 | ||||
-rw-r--r-- | luxc/src/lux/analyser.clj | 10 | ||||
-rw-r--r-- | luxc/src/lux/analyser/lux.clj | 46 | ||||
-rw-r--r-- | luxc/src/lux/analyser/meta.clj | 1 | ||||
-rw-r--r-- | luxc/src/lux/analyser/module.clj | 27 | ||||
-rw-r--r-- | luxc/src/lux/compiler/cache.clj | 6 | ||||
-rw-r--r-- | luxc/src/lux/compiler/core.clj | 7 | ||||
-rw-r--r-- | luxc/src/lux/compiler/jvm.clj | 54 | ||||
-rw-r--r-- | luxc/src/lux/compiler/jvm/lux.clj | 14 | ||||
-rw-r--r-- | luxc/src/lux/compiler/parallel.clj | 15 | ||||
-rw-r--r-- | stdlib/source/lux.lux | 524 | ||||
-rw-r--r-- | stdlib/source/lux/control/concurrency/actor.lux | 2 | ||||
-rw-r--r-- | stdlib/source/lux/host.jvm.lux | 2 | ||||
-rw-r--r-- | stdlib/source/lux/host.old.lux | 2 | ||||
-rw-r--r-- | stdlib/source/lux/macro.lux | 13 | ||||
-rw-r--r-- | stdlib/source/lux/tool/compiler/phase/analysis/reference.lux | 4 | ||||
-rw-r--r-- | stdlib/source/lux/tool/compiler/phase/extension/statement.lux | 17 | ||||
-rw-r--r-- | stdlib/source/lux/type/abstract.lux | 24 | ||||
-rw-r--r-- | stdlib/source/lux/type/implicit.lux | 4 | ||||
-rw-r--r-- | stdlib/source/test/lux/tool/compiler/phase/analysis/reference.lux | 8 |
20 files changed, 377 insertions, 404 deletions
diff --git a/documentation/research/database.md b/documentation/research/database.md index 7826c3a53..6e36919b8 100644 --- a/documentation/research/database.md +++ b/documentation/research/database.md @@ -210,6 +210,7 @@ 1. https://medium.com/@hugo.oliveira.rocha/what-they-dont-tell-you-about-event-sourcing-6afc23c69e9a 1. https://vvvvalvalval.github.io/posts/2018-11-12-datomic-event-sourcing-without-the-hassle.html 1. https://chriskiehl.com/article/event-sourcing-is-hard +1. https://medium.com/serialized-io/apache-kafka-is-not-for-event-sourcing-81735c3cf5c # Architecture diff --git a/luxc/src/lux/analyser.clj b/luxc/src/lux/analyser.clj index de5ff8725..4522b9aea 100644 --- a/luxc/src/lux/analyser.clj +++ b/luxc/src/lux/analyser.clj @@ -131,10 +131,11 @@ (|let [(&/$Cons [_ (&/$Identifier "" ?name)] (&/$Cons ?value (&/$Cons ?meta - (&/$Nil)) + (&/$Cons [_ (&/$Bit exported?)] + (&/$Nil))) )) parameters] (&/with-cursor cursor - (&&lux/analyse-def analyse optimize eval! compile-def ?name ?value ?meta))) + (&&lux/analyse-def analyse optimize eval! compile-def ?name ?value ?meta exported?))) "lux def alias" (|let [(&/$Cons [_ (&/$Identifier "" ?alias)] @@ -149,10 +150,11 @@ (&/$Cons ?value (&/$Cons ?meta (&/$Cons [_ (&/$Tuple ?tags)] - (&/$Nil))) + (&/$Cons [_ (&/$Bit exported?)] + (&/$Nil)))) )) parameters] (&/with-cursor cursor - (&&lux/analyse-def-type-tagged analyse optimize eval! compile-def ?name ?value ?meta ?tags))) + (&&lux/analyse-def-type-tagged analyse optimize eval! compile-def ?name ?value ?meta ?tags exported?))) "lux def program" (|let [(&/$Cons ?program (&/$Nil)) parameters] diff --git a/luxc/src/lux/analyser/lux.clj b/luxc/src/lux/analyser/lux.clj index 8b2428ef0..4353caefa 100644 --- a/luxc/src/lux/analyser/lux.clj +++ b/luxc/src/lux/analyser/lux.clj @@ -266,7 +266,7 @@ ))) (defn ^:private analyse-global [analyse exo-type module name] - (|do [[[r-module r-name] [endo-type ?meta ?value]] (&&module/find-def module name) + (|do [[[r-module r-name] [exported? endo-type ?meta ?value]] (&&module/find-def module name) ;; This is a small shortcut to optimize analysis of typing code. _ (if (and (&type/type= &type/Type endo-type) (&type/type= &type/Type exo-type)) @@ -381,7 +381,7 @@ (defn analyse-apply [analyse cursor exo-type macro-caller =fn ?args] (|case =fn [_ (&&/$def ?module ?name)] - (|do [[real-name [?type ?meta ?value]] (&&module/find-def! ?module ?name)] + (|do [[real-name [exported? ?type ?meta ?value]] (&&module/find-def! ?module ?name)] (if (&type/type= &type/Macro ?type) (|do [macro-expansion (fn [state] (|case (macro-caller ?value ?args state) @@ -390,13 +390,13 @@ (&/$Left error) ((&/fail-with-loc error) state))) - ;; module-name &/get-module-name + module-name &/get-module-name ;; :let [[r-prefix r-name] real-name - ;; _ (when (= "macro:'" r-name) - ;; (->> (&/|map &/show-ast macro-expansion) - ;; (&/|interpose "\n") + ;; _ (when (= "module:" r-name) + ;; (->> macro-expansion + ;; (&/|map (fn [ast] (str (&/show-ast ast) "\n"))) ;; (&/fold str "") - ;; (println 'macro-expansion (&/ident->text real-name) "@" module-name)))] + ;; (&/|log! (str 'macro-expansion " " (&/ident->text real-name) " @ " module-name "\n"))))] ] (&/flat-map% (partial analyse exo-type) macro-expansion)) (do-analyse-apply analyse exo-type =fn ?args))) @@ -542,7 +542,7 @@ (|do [output (analyse-function** analyse exo-type ?self ?arg ?body)] (return (&/|list output)))) -(defn analyse-def* [analyse optimize eval! compile-def ?name ?value ?meta & [?expected-type]] +(defn analyse-def* [analyse optimize eval! compile-def ?name ?value ?meta exported? & [?expected-type]] (|do [_ &/ensure-statement module-name &/get-module-name ? (&&module/defined? module-name ?name) @@ -556,24 +556,18 @@ (&&/analyse-1+ analyse ?value)))) =meta (&&/analyse-1 analyse &type/Code ?meta) ==meta (eval! (optimize =meta)) - def-value (compile-def ?name (optimize =value) ==meta) + def-value (compile-def ?name (optimize =value) ==meta exported?) _ &type/reset-mappings] - (return (&/T [module-name (&&/expr-type* =value) def-value ==meta])))) + (return (&/T [module-name (&&/expr-type* =value) def-value])))) -(defn analyse-def [analyse optimize eval! compile-def ?name ?value ?meta] - (|do [_ (analyse-def* analyse optimize eval! compile-def ?name ?value ?meta)] +(defn analyse-def [analyse optimize eval! compile-def ?name ?value ?meta exported?] + (|do [_ (analyse-def* analyse optimize eval! compile-def ?name ?value ?meta exported?)] (return &/$Nil))) -(defn analyse-def-type-tagged [analyse optimize eval! compile-def ?name ?value ?meta tags*] - (|do [[module-name def-type def-value ==meta] (analyse-def* analyse optimize eval! compile-def ?name ?value ?meta &type/Type) +(defn analyse-def-type-tagged [analyse optimize eval! compile-def ?name ?value ?meta tags* exported?] + (|do [[module-name def-type def-value] (analyse-def* analyse optimize eval! compile-def ?name ?value ?meta exported? &type/Type) _ (&/assert! (&type/type= &type/Type def-type) "[Analyser Error] Cannot define tags for non-type.") - :let [was-exported? (|case (&&meta/meta-get &&meta/export?-tag ==meta) - (&/$Some _) - true - - _ - false)] tags (&/map% (fn [tag*] (|case tag* [_ (&/$Text tag)] @@ -582,7 +576,7 @@ _ (&/fail-with-loc "[Analyser Error] Incorrect format for tags."))) tags*) - _ (&&module/declare-tags module-name tags was-exported? def-value)] + _ (&&module/declare-tags module-name tags exported? def-value)] (return &/$Nil))) (def ^:private dummy-cursor @@ -596,10 +590,10 @@ (defn analyse-def-alias [?alias ?original] (|let [[r-module r-name] ?original] - (|do [[_ [original-type original-anns original-value]] (&&module/find-def! r-module r-name) + (|do [[_ [exported? original-type original-anns original-value]] (&&module/find-def! r-module r-name) module-name &/get-module-name _ (&/without-repl-closure - (&&module/define module-name ?alias + (&&module/define module-name ?alias false original-type (alias-annotations r-module r-name) original-value))] @@ -694,12 +688,6 @@ (try-async-compilation path compile-module)))))) _imports) _compiler get-compiler - ;; Some type-vars in the typing environment stay in - ;; the environment forever, making type-checking slower. - ;; The merging process for compilers more-or-less "fixes" the - ;; problem by resetting the typing enviroment, but ideally - ;; those type-vars should not survive in the first place. - ;; TODO: MUST FIX _ (&/fold% (fn [compiler _async] (|case @_async (&/$Right _new-compiler) diff --git a/luxc/src/lux/analyser/meta.clj b/luxc/src/lux/analyser/meta.clj index fde261b0b..53d355867 100644 --- a/luxc/src/lux/analyser/meta.clj +++ b/luxc/src/lux/analyser/meta.clj @@ -41,5 +41,4 @@ (def <name> (&/T [tag-prefix <tag-name>])) alias-tag "alias" - export?-tag "export?" ) diff --git a/luxc/src/lux/analyser/module.clj b/luxc/src/lux/analyser/module.clj index 8bc7a64a1..25f6428ca 100644 --- a/luxc/src/lux/analyser/module.clj +++ b/luxc/src/lux/analyser/module.clj @@ -106,7 +106,7 @@ state) nil)))) -(defn define [module name def-type def-meta def-value] +(defn define [module name exported? def-type def-meta def-value] (fn [state] (when (and (= "Macro'" name) (= "lux" module)) (&type/set-macro*-type! def-value)) @@ -118,7 +118,7 @@ (&/|update module (fn [m] (&/update$ $defs - #(&/|put name (&/T [def-type def-meta def-value]) %) + #(&/|put name (&/T [exported? def-type def-meta def-value]) %) m)) ms)))) nil) @@ -133,7 +133,7 @@ (fn [state] (if-let [$module (->> state (&/get$ &/$modules) (&/|get module))] (if-let [$def (->> $module (&/get$ $defs) (&/|get name))] - (|let [[?type ?meta ?value] $def] + (|let [[exported? ?type ?meta ?value] $def] (return* state ?type)) ((&/fail-with-loc (str "[Analyser Error] Unknown definition: " (str module &/+name-separator+ name))) state)) @@ -146,15 +146,9 @@ (fn [state] (if-let [$module (->> state (&/get$ &/$modules) (&/|get module))] (if-let [$def (->> $module (&/get$ $defs) (&/|get name))] - (|let [[?type ?meta ?value] $def] + (|let [[exported? ?type ?meta ?value] $def] (if (&type/type= &type/Type ?type) - (return* state (&/T [(|case (&meta/meta-get &meta/export?-tag ?meta) - (&/$Some _) - true - - _ - false) - ?value])) + (return* state (&/T [exported? ?value])) ((&/fail-with-loc (str "[Analyser Error] Not a type: " (&/ident->text (&/T [module name])) "\nMETA: " (&/show-ast ?meta))) state))) @@ -230,7 +224,7 @@ (fn [state] (if-let [$module (->> state (&/get$ &/$modules) (&/|get module))] (if-let [$def (->> $module (&/get$ $defs) (&/|get name))] - (|let [[?type ?meta ?value] $def] + (|let [[exported? ?type ?meta ?value] $def] (if (.equals ^Object current-module module) (|case (&meta/meta-get &meta/alias-tag ?meta) (&/$Some [_ (&/$Identifier [?r-module ?r-name])]) @@ -256,7 +250,7 @@ (imports? state module current-module)) (if-let [$module (->> state (&/get$ &/$modules) (&/|get module))] (if-let [$def (->> $module (&/get$ $defs) (&/|get name))] - (|let [[?type ?meta ?value] $def] + (|let [[exported? ?type ?meta ?value] $def] (if (.equals ^Object current-module module) (|case (&meta/meta-get &meta/alias-tag ?meta) (&/$Some [_ (&/$Identifier [?r-module ?r-name])]) @@ -265,11 +259,8 @@ _ (return* state (&/T [(&/T [module name]) $def]))) - (|case (&meta/meta-get &meta/export?-tag ?meta) - (&/$Some [_ (&/$Bit true)]) + (if exported? (return* state (&/T [(&/T [module name]) $def])) - - _ ((&/fail-with-loc (str "[Analyser Error @ find-def] Cannot use private definition: " (str module &/+name-separator+ name) " at module: " current-module)) state)))) @@ -411,7 +402,7 @@ (->> state (&/get$ &/$modules) (&/|get module) (&/get$ $defs) (&/|map (fn [kv] (|let [[k _def-data] kv - [_ ?def-meta _] _def-data] + [_ _ ?def-meta _] _def-data] (|case (&meta/meta-get &meta/alias-tag ?def-meta) (&/$Some [_ (&/$Identifier [?r-module ?r-name])]) (&/T [k (str ?r-module &/+name-separator+ ?r-name) _def-data]) diff --git a/luxc/src/lux/compiler/cache.clj b/luxc/src/lux/compiler/cache.clj index d6b5e8317..06dabe108 100644 --- a/luxc/src/lux/compiler/cache.clj +++ b/luxc/src/lux/compiler/cache.clj @@ -104,12 +104,12 @@ (make-identifier (&/T [__module __name]))])))] (|do [def-type (&a-module/def-type __module __name) def-value (load-def-value __module __name)] - (&a-module/define module _name def-type def-anns def-value))) - 3 (let [[_name _type _anns] parts + (&a-module/define module _name false def-type def-anns def-value))) + 4 (let [[_name _exported? _type _anns] parts [def-anns _] (&&&ann/deserialize _anns) [def-type _] (&&&type/deserialize-type _type)] (|do [def-value (load-def-value module _name)] - (&a-module/define module _name def-type def-anns def-value)))))) + (&a-module/define module _name (= "1" _exported?) def-type def-anns def-value)))))) (defn ^:private uninstall-cache [module] (|do [_ (delete module)] diff --git a/luxc/src/lux/compiler/core.clj b/luxc/src/lux/compiler/core.clj index d3fc0d9af..f2fe09887 100644 --- a/luxc/src/lux/compiler/core.clj +++ b/luxc/src/lux/compiler/core.clj @@ -50,9 +50,12 @@ tag-groups &a-module/tag-groups :let [def-entries (->> defs (&/|map (fn [_def] - (|let [[?name ?alias [?def-type ?def-anns ?def-value]] _def] + (|let [[?name ?alias [exported? ?def-type ?def-anns ?def-value]] _def] (if (= "" ?alias) - (str ?name datum-separator (&&&type/serialize-type ?def-type) datum-separator (&&&ann/serialize ?def-anns)) + (str ?name + datum-separator (if exported? "1" "0") + datum-separator (&&&type/serialize-type ?def-type) + datum-separator (&&&ann/serialize ?def-anns)) (str ?name datum-separator ?alias))))) (&/|interpose entry-separator) (&/fold str "")) diff --git a/luxc/src/lux/compiler/jvm.clj b/luxc/src/lux/compiler/jvm.clj index b5e04792a..8b70862ab 100644 --- a/luxc/src/lux/compiler/jvm.clj +++ b/luxc/src/lux/compiler/jvm.clj @@ -185,33 +185,33 @@ :let [file-hash (hash file-content) compile-module!! (&¶llel/parallel-compilation (partial compile-module source-dirs))]] (&/|eitherL (&&cache/load name) - (let [compiler-step (&analyser/analyse &optimizer/optimize eval! compile-module!! all-compilers)] - (|do [module-exists? (&a-module/exists? name)] - (if module-exists? - (&/fail-with-loc (str "[Compiler Error] Cannot re-define a module: " name)) - (|do [_ (activate-module! name file-hash) - :let [module-class-name (str (&host/->module-class name) "/_") - =class (doto (new ClassWriter ClassWriter/COMPUTE_MAXS) - (.visit &host/bytecode-version (+ Opcodes/ACC_PUBLIC Opcodes/ACC_SUPER) - module-class-name nil "java/lang/Object" nil) - (.visitSource file-name nil))] - _ (if (= "lux" name) - (|do [_ &&rt/compile-Function-class - _ &&rt/compile-LuxRT-class] - (return nil)) - (return nil))] - (fn [state] - (|case ((&/with-writer =class - (&/exhaust% compiler-step)) - (&/set$ &/$source (&reader/from name file-content) state)) - (&/$Right ?state _) - (&/run-state (|do [:let [_ (.visitEnd =class)] - _ (save-module! name file-hash (.toByteArray =class))] - (return file-hash)) - ?state) - - (&/$Left ?message) - (&/fail* ?message)))))))) + (|do [module-exists? (&a-module/exists? name)] + (if module-exists? + (&/fail-with-loc (str "[Compiler Error] Cannot re-define a module: " name)) + (|do [_ (activate-module! name file-hash) + :let [module-class-name (str (&host/->module-class name) "/_") + =class (doto (new ClassWriter ClassWriter/COMPUTE_MAXS) + (.visit &host/bytecode-version (+ Opcodes/ACC_PUBLIC Opcodes/ACC_SUPER) + module-class-name nil "java/lang/Object" nil) + (.visitSource file-name nil))] + _ (if (= "lux" name) + (|do [_ &&rt/compile-Function-class + _ &&rt/compile-LuxRT-class] + (return nil)) + (return nil)) + :let [compiler-step (&analyser/analyse &optimizer/optimize eval! compile-module!! all-compilers)]] + (fn [state] + (|case ((&/with-writer =class + (&/exhaust% compiler-step)) + (&/set$ &/$source (&reader/from name file-content) state)) + (&/$Right ?state _) + (&/run-state (|do [:let [_ (.visitEnd =class)] + _ (save-module! name file-hash (.toByteArray =class))] + (return file-hash)) + ?state) + + (&/$Left ?message) + (&/fail* ?message))))))) ))) (let [define-class (doto (.getDeclaredMethod java.lang.ClassLoader "defineClass" (into-array [String diff --git a/luxc/src/lux/compiler/jvm/lux.clj b/luxc/src/lux/compiler/jvm/lux.clj index 4af29d2f6..28418a6f8 100644 --- a/luxc/src/lux/compiler/jvm/lux.clj +++ b/luxc/src/lux/compiler/jvm/lux.clj @@ -117,7 +117,7 @@ (defn compile-apply [compile ?fn ?args] (|case ?fn [_ (&o/$def ?module ?name)] - (|do [[_ [_ _ func-obj]] (&a-module/find-def! ?module ?name) + (|do [[_ [_ _ _ func-obj]] (&a-module/find-def! ?module ?name) class-loader &/loader :let [func-class (class func-obj) func-arity (.get ^Field (.getDeclaredField func-class &&/arity-field) nil) @@ -250,7 +250,7 @@ (str base "\n\n" "Caused by: " (throwable->text cause)) base))) -(defn ^:private install-def! [class-loader current-class module-name ?name ?body ?meta] +(defn ^:private install-def! [class-loader current-class module-name ?name ?body ?meta exported?] (|do [_ (return nil) :let [def-class (&&/load-class! class-loader (&host-generics/->class-name current-class)) def-type (&a/expr-type* ?body)] @@ -260,12 +260,12 @@ (str "Error during value initialization:\n" (throwable->text t))))) _ (&/without-repl-closure - (&a-module/define module-name ?name def-type ?meta def-value))] + (&a-module/define module-name ?name exported? def-type ?meta def-value))] (return def-value))) (let [class-flags (+ Opcodes/ACC_PUBLIC Opcodes/ACC_FINAL Opcodes/ACC_SUPER) field-flags (+ Opcodes/ACC_PUBLIC Opcodes/ACC_FINAL Opcodes/ACC_STATIC)] - (defn compile-def [compile ?name ?body ?meta] + (defn compile-def [compile ?name ?body ?meta exported?] (|do [module-name &/get-module-name class-loader &/loader] (|case (&a-meta/meta-get &a-meta/alias-tag ?meta) @@ -278,7 +278,7 @@ def-value (-> def-class (.getField &/value-field) (.get nil))] def-type (&a-module/def-type r-module r-name) _ (&/without-repl-closure - (&a-module/define module-name ?name def-type ?meta def-value))] + (&a-module/define module-name ?name false def-type ?meta def-value))] (return nil)) (&/fail-with-loc (str "[Compilation Error] Aliases cannot contain meta-data: " (str module-name &/+name-separator+ ?name))))) @@ -314,7 +314,7 @@ (return nil))) :let [_ (.visitEnd =class)] _ (&&/save-class! def-name (.toByteArray =class)) - def-value (install-def! class-loader current-class module-name ?name ?body ?meta) + def-value (install-def! class-loader current-class module-name ?name ?body ?meta exported?) :let [_ (println 'DEF (str module-name &/+name-separator+ ?name))]] (return def-value))) @@ -341,7 +341,7 @@ (return nil))) :let [_ (.visitEnd =class)] _ (&&/save-class! def-name (.toByteArray =class)) - def-value (install-def! class-loader current-class module-name ?name ?body ?meta) + def-value (install-def! class-loader current-class module-name ?name ?body ?meta exported?) :let [_ (println 'DEF (str module-name &/+name-separator+ ?name))]] (return def-value))) )))) diff --git a/luxc/src/lux/compiler/parallel.clj b/luxc/src/lux/compiler/parallel.clj index 1c4da1a11..28716b45b 100644 --- a/luxc/src/lux/compiler/parallel.clj +++ b/luxc/src/lux/compiler/parallel.clj @@ -31,12 +31,15 @@ (.start (new Thread (fn [] (let [out-str (with-out-str - (|case (&/run-state (compile-module* module-name) - compiler) - (&/$Right post-compiler _) - (deliver task (&/$Right post-compiler)) + (try (|case (&/run-state (compile-module* module-name) + compiler) + (&/$Right post-compiler _) + (deliver task (&/$Right post-compiler)) - (&/$Left ?error) - (deliver task (&/$Left ?error))))] + (&/$Left ?error) + (deliver task (&/$Left ?error))) + (catch Throwable ex + (.printStackTrace ex) + (deliver task (&/$Left "")))))] (&/|log! out-str))))))]] (return task)))) diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index 91ee40db9..9e370f12b 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -1,21 +1,22 @@ ("lux def" dummy-cursor ["" 0 0] - [["" 0 0] - (10 (1 [[["" 0 0] (7 ["lux" "export?"])] - [["" 0 0] (0 #1)]] - (0)))]) + [["" 0 0] (10 (0))] + #1) ("lux def" double-quote ("lux i64 char" +34) - [dummy-cursor (10 (0))]) + [dummy-cursor (10 (0))] + #0) ("lux def" new-line ("lux i64 char" +10) - [dummy-cursor (10 (0))]) + [dummy-cursor (10 (0))] + #0) ("lux def" __paragraph ("lux text concat" new-line new-line) - [dummy-cursor (10 (0))]) + [dummy-cursor (10 (0))] + #0) ## (type: Any ## (Ex [a] a)) @@ -24,13 +25,12 @@ (10 ["lux" "Any"] (8 (0) (4 1)))) [dummy-cursor - (10 (1 [[dummy-cursor (7 ["lux" "export?"])] - [dummy-cursor (0 #1)]] - (1 [[dummy-cursor (7 ["lux" "doc"])] - [dummy-cursor (5 ("lux text concat" - ("lux text concat" "The type of things whose type is irrelevant." __paragraph) - "It can be used to write functions or data-structures that can take, or return, anything."))]] - (0))))]) + (10 (1 [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 ("lux text concat" + ("lux text concat" "The type of things whose type is irrelevant." __paragraph) + "It can be used to write functions or data-structures that can take, or return, anything."))]] + (0)))] + #1) ## (type: Nothing ## (All [a] a)) @@ -39,13 +39,12 @@ (10 ["lux" "Nothing"] (7 (0) (4 1)))) [dummy-cursor - (10 (1 [[dummy-cursor (7 ["lux" "export?"])] - [dummy-cursor (0 #1)]] - (1 [[dummy-cursor (7 ["lux" "doc"])] - [dummy-cursor (5 ("lux text concat" - ("lux text concat" "The type of things whose type is undefined." __paragraph) - "Useful for expressions that cause errors or other 'extraordinary' conditions."))]] - (0))))]) + (10 (1 [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 ("lux text concat" + ("lux text concat" "The type of things whose type is undefined." __paragraph) + "Useful for expressions that cause errors or other 'extraordinary' conditions."))]] + (0)))] + #1) ## (type: (List a) ## #Nil @@ -59,25 +58,23 @@ (2 (4 1) (9 (4 1) (4 0)))))) [dummy-cursor - (10 (1 [[dummy-cursor (7 ["lux" "export?"])] - [dummy-cursor (0 #1)]] - (1 [[dummy-cursor (7 ["lux" "type-args"])] - [dummy-cursor (9 (1 [dummy-cursor (5 "a")] (0)))]] - (1 [[dummy-cursor (7 ["lux" "doc"])] - [dummy-cursor (5 "A potentially empty list of values.")]] - (0)))))] - ["Nil" "Cons"]) + (10 (1 [[dummy-cursor (7 ["lux" "type-args"])] + [dummy-cursor (9 (1 [dummy-cursor (5 "a")] (0)))]] + (1 [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "A potentially empty list of values.")]] + (0))))] + ["Nil" "Cons"] + #1) ("lux def" Bit ("lux check type" (10 ["lux" "Bit"] (0 "#Bit" #Nil))) [dummy-cursor - (10 (#Cons [[dummy-cursor (7 ["lux" "export?"])] - [dummy-cursor (0 #1)]] - (#Cons [[dummy-cursor (7 ["lux" "doc"])] - [dummy-cursor (5 "Your standard, run-of-the-mill boolean values (as bits).")]] - #Nil)))]) + (10 (#Cons [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "Your standard, run-of-the-mill boolean values (as bits).")]] + #Nil))] + #1) ("lux def" I64 ("lux check type" @@ -85,81 +82,74 @@ (7 (0) (0 "#I64" (#Cons (4 1) #Nil))))) [dummy-cursor - (10 (#Cons [[dummy-cursor (7 ["lux" "export?"])] - [dummy-cursor (0 #1)]] - (#Cons [[dummy-cursor (7 ["lux" "doc"])] - [dummy-cursor (5 "64-bit integers without any semantics.")]] - #Nil)))]) + (10 (#Cons [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "64-bit integers without any semantics.")]] + #Nil))] + #1) ("lux def" Nat ("lux check type" (10 ["lux" "Nat"] (0 "#I64" (#Cons (0 "#Nat" #Nil) #Nil)))) [dummy-cursor - (10 (#Cons [[dummy-cursor (7 ["lux" "export?"])] - [dummy-cursor (0 #1)]] - (#Cons [[dummy-cursor (7 ["lux" "doc"])] - [dummy-cursor (5 ("lux text concat" - ("lux text concat" "Natural numbers (unsigned integers)." __paragraph) - "They start at zero (0) and extend in the positive direction."))]] - #Nil)))]) + (10 (#Cons [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 ("lux text concat" + ("lux text concat" "Natural numbers (unsigned integers)." __paragraph) + "They start at zero (0) and extend in the positive direction."))]] + #Nil))] + #1) ("lux def" Int ("lux check type" (10 ["lux" "Int"] (0 "#I64" (#Cons (0 "#Int" #Nil) #Nil)))) [dummy-cursor - (10 (#Cons [[dummy-cursor (7 ["lux" "export?"])] - [dummy-cursor (0 #1)]] - (#Cons [[dummy-cursor (7 ["lux" "doc"])] - [dummy-cursor (5 "Your standard, run-of-the-mill integer numbers.")]] - #Nil)))]) + (10 (#Cons [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "Your standard, run-of-the-mill integer numbers.")]] + #Nil))] + #1) ("lux def" Rev ("lux check type" (10 ["lux" "Rev"] (0 "#I64" (#Cons (0 "#Rev" #Nil) #Nil)))) [dummy-cursor - (10 (#Cons [[dummy-cursor (7 ["lux" "export?"])] - [dummy-cursor (0 #1)]] - (#Cons [[dummy-cursor (7 ["lux" "doc"])] - [dummy-cursor (5 ("lux text concat" - ("lux text concat" "Fractional numbers that live in the interval [0,1)." __paragraph) - "Useful for probability, and other domains that work within that interval."))]] - #Nil)))]) + (10 (#Cons [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 ("lux text concat" + ("lux text concat" "Fractional numbers that live in the interval [0,1)." __paragraph) + "Useful for probability, and other domains that work within that interval."))]] + #Nil))] + #1) ("lux def" Frac ("lux check type" (10 ["lux" "Frac"] (0 "#Frac" #Nil))) [dummy-cursor - (10 (#Cons [[dummy-cursor (7 ["lux" "export?"])] - [dummy-cursor (0 #1)]] - (#Cons [[dummy-cursor (7 ["lux" "doc"])] - [dummy-cursor (5 "Your standard, run-of-the-mill floating-point (fractional) numbers.")]] - #Nil)))]) + (10 (#Cons [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "Your standard, run-of-the-mill floating-point (fractional) numbers.")]] + #Nil))] + #1) ("lux def" Text ("lux check type" (10 ["lux" "Text"] (0 "#Text" #Nil))) [dummy-cursor - (10 (#Cons [[dummy-cursor (7 ["lux" "export?"])] - [dummy-cursor (0 #1)]] - (#Cons [[dummy-cursor (7 ["lux" "doc"])] - [dummy-cursor (5 "Your standard, run-of-the-mill string values.")]] - #Nil)))]) + (10 (#Cons [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "Your standard, run-of-the-mill string values.")]] + #Nil))] + #1) ("lux def" Name ("lux check type" (10 ["lux" "Name"] (2 Text Text))) [dummy-cursor - (10 (#Cons [[dummy-cursor (7 ["lux" "export?"])] - [dummy-cursor (0 #1)]] - (#Cons [[dummy-cursor (7 ["lux" "doc"])] - [dummy-cursor (5 "A name. It is used as part of Lux syntax to represent identifiers and tags.")]] - #Nil)))]) + (10 (#Cons [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "A name. It is used as part of Lux syntax to represent identifiers and tags.")]] + #Nil))] + #1) ## (type: (Maybe a) ## #None @@ -172,14 +162,13 @@ ## "lux.Some" (4 1)))) [dummy-cursor - (10 (#Cons [[dummy-cursor (7 ["lux" "export?"])] - [dummy-cursor (0 #1)]] - (#Cons [[dummy-cursor (7 ["lux" "type-args"])] - [dummy-cursor (9 (#Cons [dummy-cursor (5 "a")] #Nil))]] - (#Cons [[dummy-cursor (7 ["lux" "doc"])] - [dummy-cursor (5 "A potentially missing value.")]] - #Nil))))] - ["None" "Some"]) + (10 (#Cons [[dummy-cursor (7 ["lux" "type-args"])] + [dummy-cursor (9 (#Cons [dummy-cursor (5 "a")] #Nil))]] + (#Cons [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "A potentially missing value.")]] + #Nil)))] + ["None" "Some"] + #1) ## (type: #rec Type ## (#Primitive Text (List Type)) @@ -227,14 +216,13 @@ ("lux check type" (9 Type List)))} ("lux check type" (9 (4 1) (4 0))))) [dummy-cursor - (10 (#Cons [[dummy-cursor (7 ["lux" "export?"])] - [dummy-cursor (0 #1)]] - (#Cons [[dummy-cursor (7 ["lux" "doc"])] - [dummy-cursor (5 "This type represents the data-structures that are used to specify types themselves.")]] - (#Cons [[dummy-cursor (7 ["lux" "type-rec?"])] - [dummy-cursor (0 #1)]] - #Nil))))] - ["Primitive" "Sum" "Product" "Function" "Parameter" "Var" "Ex" "UnivQ" "ExQ" "Apply" "Named"]) + (10 (#Cons [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "This type represents the data-structures that are used to specify types themselves.")]] + (#Cons [[dummy-cursor (7 ["lux" "type-rec?"])] + [dummy-cursor (0 #1)]] + #Nil)))] + ["Primitive" "Sum" "Product" "Function" "Parameter" "Var" "Ex" "UnivQ" "ExQ" "Apply" "Named"] + #1) ## (type: Cursor ## {#module Text @@ -246,10 +234,9 @@ [dummy-cursor (10 (#Cons [[dummy-cursor (7 ["lux" "doc"])] [dummy-cursor (5 "Cursors are for specifying the location of Code nodes in Lux files during compilation.")]] - (#Cons [[dummy-cursor (7 ["lux" "export?"])] - [dummy-cursor (0 #1)]] - #Nil)))] - ["module" "line" "column"]) + #Nil))] + ["module" "line" "column"] + #1) ## (type: (Ann m v) ## {#meta m @@ -265,10 +252,9 @@ [dummy-cursor (5 "The type of things that can be annotated with meta-data of arbitrary types.")]] (#Cons [[dummy-cursor (7 ["lux" "type-args"])] [dummy-cursor (9 (#Cons [dummy-cursor (5 "m")] (#Cons [dummy-cursor (5 "v")] #Nil)))]] - (#Cons [[dummy-cursor (7 ["lux" "export?"])] - [dummy-cursor (0 #1)]] - #Nil))))] - ["meta" "datum"]) + #Nil)))] + ["meta" "datum"] + #1) ## (type: (Code' w) ## (#Bit Bit) @@ -318,10 +304,9 @@ [dummy-cursor (10 (#Cons [[dummy-cursor (7 ["lux" "type-args"])] [dummy-cursor (9 (#Cons [dummy-cursor (5 "w")] #Nil))]] - (#Cons [[dummy-cursor (7 ["lux" "export?"])] - [dummy-cursor (0 #1)]] - #Nil)))] - ["Bit" "Nat" "Int" "Rev" "Frac" "Text" "Identifier" "Tag" "Form" "Tuple" "Record"]) + #Nil))] + ["Bit" "Nat" "Int" "Rev" "Frac" "Text" "Identifier" "Tag" "Form" "Tuple" "Record"] + #1) ## (type: Code ## (Ann Cursor (Code' (Ann Cursor)))) @@ -333,9 +318,8 @@ [dummy-cursor (#Record (#Cons [[dummy-cursor (#Tag ["lux" "doc"])] [dummy-cursor (#Text "The type of Code nodes for Lux syntax.")]] - (#Cons [[dummy-cursor (#Tag ["lux" "export?"])] - [dummy-cursor (#Bit #1)]] - #Nil)))]) + #Nil))] + #1) ("lux def" _ann ("lux check" (#Function (#Apply (#Apply Cursor Ann) @@ -343,89 +327,97 @@ Code) ([_ data] [dummy-cursor data])) - [dummy-cursor (#Record #Nil)]) + [dummy-cursor (#Record #Nil)] + #0) ("lux def" bit$ ("lux check" (#Function Bit Code) ([_ value] (_ann (#Bit value)))) - [dummy-cursor (#Record #Nil)]) + [dummy-cursor (#Record #Nil)] + #0) ("lux def" nat$ ("lux check" (#Function Nat Code) ([_ value] (_ann (#Nat value)))) - [dummy-cursor (#Record #Nil)]) + [dummy-cursor (#Record #Nil)] + #0) ("lux def" int$ ("lux check" (#Function Int Code) ([_ value] (_ann (#Int value)))) - [dummy-cursor (#Record #Nil)]) + [dummy-cursor (#Record #Nil)] + #0) ("lux def" rev$ ("lux check" (#Function Rev Code) ([_ value] (_ann (#Rev value)))) - [dummy-cursor (#Record #Nil)]) + [dummy-cursor (#Record #Nil)] + #0) ("lux def" frac$ ("lux check" (#Function Frac Code) ([_ value] (_ann (#Frac value)))) - [dummy-cursor (#Record #Nil)]) + [dummy-cursor (#Record #Nil)] + #0) ("lux def" text$ ("lux check" (#Function Text Code) ([_ text] (_ann (#Text text)))) - [dummy-cursor (#Record #Nil)]) + [dummy-cursor (#Record #Nil)] + #0) ("lux def" identifier$ ("lux check" (#Function Name Code) ([_ name] (_ann (#Identifier name)))) - [dummy-cursor (#Record #Nil)]) + [dummy-cursor (#Record #Nil)] + #0) ("lux def" local-identifier$ ("lux check" (#Function Text Code) ([_ name] (_ann (#Identifier ["" name])))) - [dummy-cursor (#Record #Nil)]) + [dummy-cursor (#Record #Nil)] + #0) ("lux def" tag$ ("lux check" (#Function Name Code) ([_ name] (_ann (#Tag name)))) - [dummy-cursor (#Record #Nil)]) + [dummy-cursor (#Record #Nil)] + #0) ("lux def" local-tag$ ("lux check" (#Function Text Code) ([_ name] (_ann (#Tag ["" name])))) - [dummy-cursor (#Record #Nil)]) + [dummy-cursor (#Record #Nil)] + #0) ("lux def" form$ ("lux check" (#Function (#Apply Code List) Code) ([_ tokens] (_ann (#Form tokens)))) - [dummy-cursor (#Record #Nil)]) + [dummy-cursor (#Record #Nil)] + #0) ("lux def" tuple$ ("lux check" (#Function (#Apply Code List) Code) ([_ tokens] (_ann (#Tuple tokens)))) - [dummy-cursor (#Record #Nil)]) + [dummy-cursor (#Record #Nil)] + #0) ("lux def" record$ ("lux check" (#Function (#Apply (#Product Code Code) List) Code) ([_ tokens] (_ann (#Record tokens)))) - [dummy-cursor (#Record #Nil)]) - -("lux def" default-def-meta-exported - ("lux check" (#Apply (#Product Code Code) List) - (#Cons [(tag$ ["lux" "export?"]) - (bit$ #1)] - #Nil)) - (record$ #Nil)) + [dummy-cursor (#Record #Nil)] + #0) ## (type: Definition -## [Type Code Any]) +## [Bit Type Code Any]) ("lux def" Definition ("lux check type" (#Named ["lux" "Definition"] - (#Product Type (#Product Code Any)))) + (#Product Bit (#Product Type (#Product Code Any))))) (record$ (#Cons [(tag$ ["lux" "doc"]) (text$ "Represents all the data associated with a definition: its type, its annotations, and its value.")] - default-def-meta-exported))) + #Nil)) + #1) ## (type: (Bindings k v) ## {#counter Nat @@ -442,8 +434,9 @@ List))))) (record$ (#Cons [(tag$ ["lux" "type-args"]) (tuple$ (#Cons (text$ "k") (#Cons (text$ "v") #Nil)))] - default-def-meta-exported)) - ["counter" "mappings"]) + #Nil)) + ["counter" "mappings"] + #1) ## (type: #export Ref ## (#Local Nat) @@ -454,8 +447,9 @@ Nat ## Captured Nat)) - (record$ default-def-meta-exported) - ["Local" "Captured"]) + (record$ #Nil) + ["Local" "Captured"] + #1) ## (type: Scope ## {#name (List Text) @@ -472,13 +466,15 @@ (#Apply (#Product Type Nat) (#Apply Text Bindings)) ## captured (#Apply (#Product Type Ref) (#Apply Text Bindings)))))) - (record$ default-def-meta-exported) - ["name" "inner" "locals" "captured"]) + (record$ #Nil) + ["name" "inner" "locals" "captured"] + #1) ("lux def" Code-List ("lux check type" (#Apply Code List)) - (record$ #Nil)) + (record$ #Nil) + #0) ## (type: (Either l r) ## (#Left l) @@ -495,8 +491,9 @@ (tuple$ (#Cons (text$ "l") (#Cons (text$ "r") #Nil)))] (#Cons [(tag$ ["lux" "doc"]) (text$ "A choice between two values of different types.")] - default-def-meta-exported))) - ["Left" "Right"]) + #Nil))) + ["Left" "Right"] + #1) ## (type: Source ## [Cursor Nat Text]) @@ -504,7 +501,8 @@ ("lux check type" (#Named ["lux" "Source"] (#Product Cursor (#Product Nat Text)))) - (record$ default-def-meta-exported)) + (record$ #Nil) + #1) ## (type: Module-State ## #Active @@ -520,8 +518,9 @@ Any ## #Cached Any))) - (record$ default-def-meta-exported) - ["Active" "Compiled" "Cached"]) + (record$ #Nil) + ["Active" "Compiled" "Cached"] + #1) ## (type: Module ## {#module-hash Nat @@ -561,8 +560,9 @@ )))))) (record$ (#Cons [(tag$ ["lux" "doc"]) (text$ "All the information contained within a Lux module.")] - default-def-meta-exported)) - ["module-hash" "module-aliases" "definitions" "imports" "tags" "types" "module-annotations" "module-state"]) + #Nil)) + ["module-hash" "module-aliases" "definitions" "imports" "tags" "types" "module-annotations" "module-state"] + #1) ## (type: Type-Context ## {#ex-counter Nat @@ -577,8 +577,9 @@ ## var-bindings (#Apply (#Product Nat (#Apply Type Maybe)) List)))) - (record$ default-def-meta-exported) - ["ex-counter" "var-counter" "var-bindings"]) + (record$ #Nil) + ["ex-counter" "var-counter" "var-bindings"] + #1) ## (type: Mode ## #Build @@ -594,8 +595,9 @@ Any))) (record$ (#Cons [(tag$ ["lux" "doc"]) (text$ "A sign that shows the conditions under which the compiler is running.")] - default-def-meta-exported)) - ["Build" "Eval" "Interpreter"]) + #Nil)) + ["Build" "Eval" "Interpreter"] + #1) ## (type: Info ## {#target Text @@ -613,8 +615,9 @@ Mode))) (record$ (#Cons [(tag$ ["lux" "doc"]) (text$ "Information about the current version and type of compiler that is running.")] - default-def-meta-exported)) - ["target" "version" "mode"]) + #Nil)) + ["target" "version" "mode"] + #1) ## (type: Lux ## {#info Info @@ -661,8 +664,9 @@ ("lux text concat" ("lux text concat" "It is provided to macros during their invocation, so they can access compiler data." __paragraph) "Caveat emptor: Avoid fiddling with it, unless you know what you're doing.")))] - default-def-meta-exported)) - ["info" "source" "cursor" "current-module" "modules" "scopes" "type-context" "expected" "seed" "scope-type-vars" "extensions" "host"]) + #Nil)) + ["info" "source" "cursor" "current-module" "modules" "scopes" "type-context" "expected" "seed" "scope-type-vars" "extensions" "host"] + #1) ## (type: (Meta a) ## (-> Lux (Either Text [Lux a]))) @@ -679,7 +683,8 @@ "These computations may fail, or modify the state of the compiler."))] (#Cons [(tag$ ["lux" "type-args"]) (tuple$ (#Cons (text$ "a") #Nil))] - default-def-meta-exported)))) + #Nil))) + #1) ## (type: Macro' ## (-> (List Code) (Meta (List Code)))) @@ -687,7 +692,8 @@ ("lux check type" (#Named ["lux" "Macro'"] (#Function Code-List (#Apply Code-List Meta)))) - (record$ default-def-meta-exported)) + (record$ #Nil) + #1) ## (type: Macro ## (primitive "#Macro")) @@ -697,7 +703,8 @@ (#Primitive "#Macro" #Nil))) (record$ (#Cons [(tag$ ["lux" "doc"]) (text$ "Functions that run at compile-time and allow you to transform and extend the language in powerful ways.")] - default-def-meta-exported))) + #Nil)) + #1) ## Base functions & macros ("lux def" return @@ -710,7 +717,8 @@ ([_ val] ([_ state] (#Right state val)))) - (record$ #Nil)) + (record$ #Nil) + #0) ("lux def" fail ("lux check" (#UnivQ #Nil @@ -722,7 +730,8 @@ ([_ msg] ([_ state] (#Left msg)))) - (record$ #Nil)) + (record$ #Nil) + #0) ("lux def" let'' ("lux macro" @@ -734,7 +743,8 @@ _ (fail "Wrong syntax for let''")} tokens))) - (record$ #.Nil)) + (record$ #.Nil) + #0) ("lux def" function'' ("lux macro" @@ -770,12 +780,14 @@ _ (fail "Wrong syntax for function''")} tokens))) - (record$ #.Nil)) + (record$ #.Nil) + #0) ("lux def" cursor-code ("lux check" Code (tuple$ (#Cons (text$ "") (#Cons (nat$ 0) (#Cons (nat$ 0) #Nil))))) - (record$ #Nil)) + (record$ #Nil) + #0) ("lux def" meta-code ("lux check" (#Function Name (#Function Code Code)) @@ -784,7 +796,8 @@ (tuple$ (#Cons cursor-code (#Cons (form$ (#Cons (tag$ tag) (#Cons value #Nil))) #Nil)))))) - (record$ #Nil)) + (record$ #Nil) + #0) ("lux def" flag-meta ("lux check" (#Function Text Code) @@ -792,42 +805,28 @@ (tuple$ (#Cons [(meta-code ["lux" "Tag"] (tuple$ (#Cons (text$ "lux") (#Cons (text$ tag) #Nil)))) (#Cons [(meta-code ["lux" "Bit"] (bit$ #1)) #Nil])])))) - (record$ #Nil)) - -("lux def" export-meta - ("lux check" (#Product Code Code) - [(tag$ ["lux" "export?"]) (bit$ #1)]) - (record$ #Nil)) - -("lux def" export?-meta - ("lux check" Code - (flag-meta "export?")) - (record$ #Nil)) - -("lux def" with-export-meta - ("lux check" (#Function Code Code) - (function'' [tail] - (form$ (#Cons (tag$ ["lux" "Cons"]) - (#Cons export?-meta - (#Cons tail #Nil)))))) - (record$ #Nil)) + (record$ #Nil) + #0) ("lux def" doc-meta ("lux check" (#Function Text (#Product Code Code)) (function'' [doc] [(tag$ ["lux" "doc"]) (text$ doc)])) - (record$ #Nil)) + (record$ #Nil) + #0) ("lux def" as-def - ("lux check" (#Function Code (#Function Code (#Function Code Code))) - (function'' [name value annotations] - (form$ (#Cons (text$ "lux def") (#Cons name (#Cons value (#Cons annotations #Nil))))))) - (record$ #Nil)) + ("lux check" (#Function Code (#Function Code (#Function Code (#Function Bit Code)))) + (function'' [name value annotations exported?] + (form$ (#Cons (text$ "lux def") (#Cons name (#Cons value (#Cons annotations (#Cons (bit$ exported?) #Nil)))))))) + (record$ #Nil) + #0) ("lux def" as-checked ("lux check" (#Function Code (#Function Code Code)) (function'' [type value] (form$ (#Cons (text$ "lux check") (#Cons type (#Cons value #Nil)))))) - (record$ #Nil)) + (record$ #Nil) + #0) ("lux def" as-function ("lux check" (#Function Code (#Function (#Apply Code List) (#Function Code Code))) @@ -836,7 +835,8 @@ (#Cons self (#Cons (tuple$ inputs) (#Cons output #Nil))))))) - (record$ #Nil)) + (record$ #Nil) + #0) ("lux def" as-macro ("lux check" (#Function Code Code) @@ -844,7 +844,8 @@ (form$ (#Cons (text$ "lux macro") (#Cons expression #Nil))))) - (record$ #Nil)) + (record$ #Nil) + #0) ("lux def" def:'' ("lux macro" @@ -854,15 +855,17 @@ (#Cons [meta (#Cons [type (#Cons [body #Nil])])])])]) (return (#Cons [(as-def name (as-checked type (as-function name args body)) (form$ (#Cons (identifier$ ["lux" "record$"]) - (#Cons (with-export-meta meta) - #Nil)))) + (#Cons meta + #Nil))) + #1) #Nil])) (#Cons [[_ (#Tag ["" "export"])] (#Cons [name (#Cons [meta (#Cons [type (#Cons [body #Nil])])])])]) (return (#Cons [(as-def name (as-checked type body) (form$ (#Cons (identifier$ ["lux" "record$"]) - (#Cons (with-export-meta meta) - #Nil)))) + (#Cons meta + #Nil))) + #1) #Nil])) (#Cons [[_ (#Form (#Cons [name args]))] @@ -870,20 +873,23 @@ (return (#Cons [(as-def name (as-checked type (as-function name args body)) (form$ (#Cons (identifier$ ["lux" "record$"]) (#Cons meta - #Nil)))) + #Nil))) + #0) #Nil])) (#Cons [name (#Cons [meta (#Cons [type (#Cons [body #Nil])])])]) (return (#Cons [(as-def name (as-checked type body) (form$ (#Cons (identifier$ ["lux" "record$"]) (#Cons meta - #Nil)))) + #Nil))) + #0) #Nil])) _ (fail "Wrong syntax for def''")} tokens))) - (record$ #.Nil)) + (record$ #.Nil) + #0) ("lux def" macro:' ("lux macro" @@ -892,27 +898,31 @@ (return (#Cons (as-def name (as-macro (as-function name args body)) (form$ (#Cons (identifier$ ["lux" "record$"]) (#Cons (tag$ ["lux" "Nil"]) - #Nil)))) + #Nil))) + #0) #Nil)) (#Cons [_ (#Tag ["" "export"])] (#Cons [_ (#Form (#Cons name args))] (#Cons body #Nil))) (return (#Cons (as-def name (as-macro (as-function name args body)) (form$ (#Cons (identifier$ ["lux" "record$"]) - (#Cons (with-export-meta (tag$ ["lux" "Nil"])) - #Nil)))) + (#Cons (tag$ ["lux" "Nil"]) + #Nil))) + #1) #Nil)) (#Cons [_ (#Tag ["" "export"])] (#Cons [_ (#Form (#Cons name args))] (#Cons meta-data (#Cons body #Nil)))) (return (#Cons (as-def name (as-macro (as-function name args body)) (form$ (#Cons (identifier$ ["lux" "record$"]) - (#Cons (with-export-meta meta-data) - #Nil)))) + (#Cons meta-data + #Nil))) + #1) #Nil)) _ (fail "Wrong syntax for macro:'")} tokens))) - (record$ #.Nil)) + (record$ #.Nil) + #0) (macro:' #export (comment tokens) (#Cons [(tag$ ["lux" "doc"]) @@ -1017,24 +1027,18 @@ syntax} syntax)) -(def:'' (n/+ param subject) - (#.Cons (doc-meta "Nat(ural) addition.") - (#.Cons export-meta - #.Nil)) +(def:'' #export (n/+ param subject) + (#.Cons (doc-meta "Nat(ural) addition.") #.Nil) (#Function Nat (#Function Nat Nat)) ("lux i64 +" subject param)) -(def:'' (n/- param subject) - (#.Cons (doc-meta "Nat(ural) substraction.") - (#.Cons export-meta - #.Nil)) +(def:'' #export (n/- param subject) + (#.Cons (doc-meta "Nat(ural) substraction.") #.Nil) (#Function Nat (#Function Nat Nat)) ("lux i64 -" param subject)) -(def:'' (n/* param subject) - (#.Cons (doc-meta "Nat(ural) multiplication.") - (#.Cons export-meta - #.Nil)) +(def:'' #export (n/* param subject) + (#.Cons (doc-meta "Nat(ural) multiplication.") #.Nil) (#Function Nat (#Function Nat Nat)) ("lux coerce" Nat ("lux i64 *" @@ -1333,8 +1337,9 @@ (tuple$ args) body)))) (form$ (#Cons (identifier$ ["lux" "record$"]) - (#Cons (with-export-meta meta) - #Nil))))))) + (#Cons meta + #Nil))) + (bit$ #1))))) (#Cons [[_ (#Tag ["" "export"])] (#Cons [name (#Cons [meta (#Cons [type (#Cons [body #Nil])])])])]) (return (list (form$ (list (text$ "lux def") @@ -1343,8 +1348,9 @@ type body)) (form$ (#Cons (identifier$ ["lux" "record$"]) - (#Cons (with-export-meta meta) - #Nil))))))) + (#Cons meta + #Nil))) + (bit$ #1))))) (#Cons [[_ (#Form (#Cons [name args]))] (#Cons [meta (#Cons [type (#Cons [body #Nil])])])]) @@ -1358,7 +1364,8 @@ body)))) (form$ (#Cons (identifier$ ["lux" "record$"]) (#Cons meta - #Nil))))))) + #Nil))) + (bit$ #0))))) (#Cons [name (#Cons [meta (#Cons [type (#Cons [body #Nil])])])]) (return (list (form$ (list (text$ "lux def") @@ -1366,7 +1373,8 @@ (form$ (list (text$ "lux check") type body)) (form$ (#Cons (identifier$ ["lux" "record$"]) (#Cons meta - #Nil))))))) + #Nil))) + (bit$ #0))))) _ (fail "Wrong syntax for def:'''")} @@ -1520,7 +1528,8 @@ ($' m a) ($' m b)))))) (record$ (list)) - ["wrap" "bind"]) + ["wrap" "bind"] + #0) (def:''' maybe-monad #Nil @@ -1715,7 +1724,7 @@ #seed seed #expected expected #cursor cursor #extensions extensions #scope-type-vars scope-type-vars} state] ({(#Some {#module-hash _ #module-aliases _ #definitions definitions #imports _ #tags tags #types types #module-annotations _ #module-state _}) - ({(#Some [def-type def-meta def-value]) + ({(#Some [exported? def-type def-meta def-value]) ({(#Some [_ (#Identifier real-name)]) (#Right [state real-name]) @@ -2518,26 +2527,19 @@ [$module (get module modules) gdef (let' [{#module-hash _ #module-aliases _ #definitions bindings #imports _ #tags tags #types types #module-annotations _ #module-state _} ("lux check" Module $module)] (get name bindings))] - (let' [[def-type def-meta def-value] ("lux check" Definition gdef)] - ({#1 - ({(#Some [_ (#Bit #1)]) + (let' [[exported? def-type def-meta def-value] ("lux check" Definition gdef)] + (if (macro-type? def-type) + (if exported? (#Some ("lux coerce" Macro def-value)) - - _ (if (text@= module current-module) (#Some ("lux coerce" Macro def-value)) - #None)} - (get-meta ["lux" "export?"] def-meta)) - - #0 + #None)) ({(#Some [_ (#Identifier [r-module r-name])]) (find-macro' modules current-module r-module r-name) _ #None} - (get-meta ["lux" "alias"] def-meta))} - (macro-type? def-type))) - )) + (get-meta ["lux" "alias"] def-meta)))))) (def:''' (normalize name) #Nil @@ -2913,11 +2915,11 @@ #None body'} ?type)] - (return (list (` ("lux def" (~ name) (~ body'') + (return (list (` ("lux def" (~ name) + (~ body'') [(~ cursor-code) - (#.Record (~ (if export? - (with-export-meta (tag$ ["lux" "Nil"])) - (tag$ ["lux" "Nil"]))))]))))) + (#.Record #.Nil)] + (~ (bit$ export?))))))) #None (fail "Wrong syntax for def'")} @@ -3253,7 +3255,7 @@ "(def: branching-exponent" ..new-line " Int" ..new-line " +5)"))]) - (let [[export? tokens'] (export^ tokens) + (let [[exported? tokens'] (export^ tokens) parts (: (Maybe [Code (List Code) (Maybe Code) Code (List [Code Code])]) (case tokens' (^ (list [_ (#Form (#Cons name args))] [_ (#Record meta-kvs)] type body)) @@ -3300,10 +3302,8 @@ (return (list (` ("lux def" (~ name) (~ body) [(~ cursor-code) - (#.Record (~ (with-func-args args - (if export? - (with-export-meta =meta) - =meta))))]))))) + (#.Record (~ (with-func-args args =meta)))] + (~ (bit$ exported?))))))) #None (fail "Wrong syntax for def:")))) @@ -3370,9 +3370,8 @@ (return (list (` ("lux def" (~ name) (~ body) [(~ cursor-code) - (#Record (~ (if exported? - (with-export-meta =meta) - =meta)))]))))) + (#Record (~ =meta))] + (~ (bit$ exported?))))))) #None (fail "Wrong syntax for macro:")))) @@ -3777,7 +3776,7 @@ (: (-> Code (Meta [Code Code])) (function (_ token) (case token - (^ [_ (#Form (list [_ (#Text "lux def")] [_ (#Identifier "" tag-name)] value meta))]) + (^ [_ (#Form (list [_ (#Text "lux def")] [_ (#Identifier "" tag-name)] value meta [_ (#Bit #0)]))]) (case (get tag-name tag-mappings) (#Some tag) (wrap [tag value]) @@ -3909,9 +3908,6 @@ _ (#Some (` (.All (~ type-name) [(~+ args)] (~ type))))))) total-meta (let [meta (process-def-meta meta) - meta (if exported? - (with-export-meta meta) - meta) meta (if rec? (` (#.Cons (~ (flag-meta "type-rec?")) (~ meta))) meta)] @@ -3927,13 +3923,15 @@ (` ("lux def type tagged" (~ type-name) (~ typeC) (~ total-meta) - [(~+ (list@map text$ tags))])) + [(~+ (list@map text$ tags))] + (~ (bit$ exported?)))) _ (` ("lux def" (~ type-name) ("lux check type" (~ typeC)) - (~ total-meta))))))) + (~ total-meta) + (~ (bit$ exported?)))))))) #None (fail "Wrong syntax for type:")))) @@ -4231,12 +4229,9 @@ (#Some =module) (let [to-alias (list@map (: (-> [Text Definition] (List Text)) - (function (_ [name [def-type def-meta def-value]]) - (case (get-meta ["lux" "export?"] def-meta) - (#Some [_ (#Bit #1)]) + (function (_ [name [exported? def-type def-meta def-value]]) + (if exported? (list name) - - _ (list)))) (let [{#module-hash _ #module-aliases _ #definitions definitions #imports _ #tags tags #types types #module-annotations _ #module-state _} =module] definitions))] @@ -4312,7 +4307,7 @@ #None #None - (#Some [def-type def-meta def-value]) + (#Some [exported? def-type def-meta def-value]) (#Some def-type))))) (def: (find-def-value name state) @@ -4331,7 +4326,7 @@ #None (#Left (text@compose "Unknown definition: " (name@encode name))) - (#Some [def-type def-meta def-value]) + (#Some [exported? def-type def-meta def-value]) (#Right [state [def-type def-value]]))))) (def: (find-type-var idx bindings) @@ -4609,7 +4604,8 @@ _ (return (list (` ("lux def" (~ (local-identifier$ (de-alias "" short alias))) (~ source+) - [(~ cursor-code) (#.Record #Nil)]))))))) + [(~ cursor-code) (#.Record #Nil)] + #0))))))) (macro: #export (open: tokens) {#.doc (text$ ($_ "lux text concat" @@ -4647,7 +4643,8 @@ (do meta-monad [g!struct (gensym "struct")] (return (list (` ("lux def" (~ g!struct) (~ struct) - [(~ cursor-code) (#.Record #Nil)])) + [(~ cursor-code) (#.Record #Nil)] + #0)) (` (..open: (~ (text$ alias)) (~ g!struct))))))) _ @@ -4689,16 +4686,7 @@ #let [[referral options] referral+options] openings+options (parse-openings options) #let [[openings options] openings+options] - current-module current-module-name - #let [test-referrals (: (-> Text (List Text) (List Text) (Meta (List Any))) - (function (_ module-name all-defs referred-defs) - (monad@map meta-monad - (: (-> Text (Meta Any)) - (function (_ _def) - (if (is-member? all-defs _def) - (return []) - (fail ($_ text@compose _def " is not defined in module " module-name " @ " current-module))))) - referred-defs)))]] + current-module current-module-name] (case options #Nil (wrap {#refer-defs referral diff --git a/stdlib/source/lux/control/concurrency/actor.lux b/stdlib/source/lux/control/concurrency/actor.lux index a6cb52564..6c0d1928e 100644 --- a/stdlib/source/lux/control/concurrency/actor.lux +++ b/stdlib/source/lux/control/concurrency/actor.lux @@ -169,7 +169,7 @@ (def: #export (<resolve> name) (-> Name (Meta Name)) (do macro.monad - [[_ annotations _] (macro.find-def name)] + [[_ _ annotations _] (macro.find-def name)] (case (macro.get-tag-ann (name-of <tag>) annotations) (#.Some actor-name) (wrap actor-name) diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux index 1113868e8..362eed4e5 100644 --- a/stdlib/source/lux/host.jvm.lux +++ b/stdlib/source/lux/host.jvm.lux @@ -394,7 +394,7 @@ [current-module macro.current-module-name definitions (macro.definitions current-module)] (wrap (list@fold (: (-> [Text Definition] Class-Imports Class-Imports) - (function (_ [short-name [_ meta _]] imports) + (function (_ [short-name [_ _ meta _]] imports) (case (macro.get-text-ann (name-of #..jvm-class) meta) (#.Some full-class-name) (add-import [short-name full-class-name] imports) diff --git a/stdlib/source/lux/host.old.lux b/stdlib/source/lux/host.old.lux index 0c6cfcd9e..32bb3887f 100644 --- a/stdlib/source/lux/host.old.lux +++ b/stdlib/source/lux/host.old.lux @@ -370,7 +370,7 @@ [current-module macro.current-module-name definitions (macro.definitions current-module)] (wrap (list@fold (: (-> [Text Definition] Class-Imports Class-Imports) - (function (_ [short-name [_ meta _]] imports) + (function (_ [short-name [_ _ meta _]] imports) (case (macro.get-text-ann (name-of #..jvm-class) meta) (#.Some full-class-name) (add-import [short-name full-class-name] imports) diff --git a/stdlib/source/lux/macro.lux b/stdlib/source/lux/macro.lux index 833af5656..23d1223e4 100644 --- a/stdlib/source/lux/macro.lux +++ b/stdlib/source/lux/macro.lux @@ -201,7 +201,6 @@ (-> Code Bit) (flag-set? (name-of <tag>)))] - [export? #.export? "exported"] [structure? #.struct? "a structure"] [recursive-type? #.type-rec? "a recursive type"] [signature? #.sig? "a signature"] @@ -258,7 +257,7 @@ (Maybe Macro)) (do maybe.monad [$module (get module modules) - [def-type def-anns def-value] (: (Maybe Definition) (|> (: Module $module) (get@ #.definitions) (get name)))] + [exported? def-type def-anns def-value] (: (Maybe Definition) (|> (: Module $module) (get@ #.definitions) (get name)))] (if (macro-type? def-type) (#.Some (:coerce Macro def-value)) (case (get-identifier-ann (name-of #.alias) def-anns) @@ -534,7 +533,7 @@ {#.doc "Looks-up a definition's type in the available modules (including the current one)."} (-> Name (Meta Type)) (do ..monad - [[def-type def-data def-value] (find-def name)] + [[exported? def-type def-data def-value] (find-def name)] (clean-type def-type))) (def: #export (find-type name) @@ -554,7 +553,7 @@ {#.doc "Finds the value of a type definition (such as Int, Any or Lux)."} (-> Name (Meta Type)) (do ..monad - [[def-type def-data def-value] (find-def name)] + [[exported? def-type def-data def-value] (find-def name)] (wrap (:coerce Type def-value)))) (def: #export (definitions module-name) @@ -571,8 +570,8 @@ (-> Text (Meta (List [Text Definition]))) (do ..monad [definitions (definitions module-name)] - (wrap (list.filter (function (_ [name [def-type def-anns def-value]]) - (export? def-anns)) + (wrap (list.filter (function (_ [name [exported? def-type def-anns def-value]]) + exported?) definitions)))) (def: #export modules @@ -690,7 +689,7 @@ {#.doc "Given an aliased definition's name, returns the original definition being referenced."} (-> Name (Meta Name)) (do ..monad - [[_ def-anns _] (find-def def-name)] + [[_ _ def-anns _] (find-def def-name)] (case (get-identifier-ann (name-of #.alias) def-anns) (#.Some real-def-name) (wrap real-def-name) diff --git a/stdlib/source/lux/tool/compiler/phase/analysis/reference.lux b/stdlib/source/lux/tool/compiler/phase/analysis/reference.lux index 4ffa673fc..a484eaebb 100644 --- a/stdlib/source/lux/tool/compiler/phase/analysis/reference.lux +++ b/stdlib/source/lux/tool/compiler/phase/analysis/reference.lux @@ -30,7 +30,7 @@ (-> Name (Operation Analysis)) (with-expansions [<return> (wrap (|> def-name ////reference.constant #/.Reference))] (do ///.monad - [[actualT def-anns _] (///extension.lift (macro.find-def def-name))] + [[exported? actualT def-anns _] (///extension.lift (macro.find-def def-name))] (case (macro.get-identifier-ann (name-of #.alias) def-anns) (#.Some real-def-name) (definition real-def-name) @@ -42,7 +42,7 @@ current (///extension.lift macro.current-module-name)] (if (text@= current ::module) <return> - (if (macro.export? def-anns) + (if exported? (do @ [imported! (///extension.lift (macro.imported-by? ::module current))] (if imported! diff --git a/stdlib/source/lux/tool/compiler/phase/extension/statement.lux b/stdlib/source/lux/tool/compiler/phase/extension/statement.lux index 623019971..2b17c9f8a 100644 --- a/stdlib/source/lux/tool/compiler/phase/extension/statement.lux +++ b/stdlib/source/lux/tool/compiler/phase/extension/statement.lux @@ -130,7 +130,7 @@ (-> Expander Handler) (function (_ extension-name phase inputsC+) (case inputsC+ - (^ (list [_ (#.Identifier ["" short-name])] valueC annotationsC)) + (^ (list [_ (#.Identifier ["" short-name])] valueC annotationsC [_ (#.Bit exported?)])) (do ///.monad [current-module (////statement.lift-analysis (//.lift macro.current-module-name)) @@ -139,7 +139,7 @@ #let [annotations (:coerce Code annotations)] [type valueT valueN value] (..definition full-name #.None valueC) _ (////statement.lift-analysis - (module.define short-name [type annotations value])) + (module.define short-name [exported? type annotations value])) #let [_ (log! (format "Definition " (%name full-name)))] _ (////statement.lift-generation (///generation.learn full-name valueN)) @@ -168,8 +168,8 @@ (def: (def::type-tagged expander) (-> Expander Handler) (..custom - [($_ p.and s.local-identifier s.any s.any (s.tuple (p.some s.text))) - (function (_ extension-name phase [short-name valueC annotationsC tags]) + [($_ p.and s.local-identifier s.any s.any (s.tuple (p.some s.text)) s.bit) + (function (_ extension-name phase [short-name valueC annotationsC tags exported?]) (do ///.monad [current-module (////statement.lift-analysis (//.lift macro.current-module-name)) @@ -179,8 +179,8 @@ [type valueT valueN value] (..definition full-name (#.Some .Type) valueC) _ (////statement.lift-analysis (do ///.monad - [_ (module.define short-name [type annotations value])] - (module.declare-tags tags (macro.export? annotations) (:coerce Type value)))) + [_ (module.define short-name [exported? type annotations value])] + (module.declare-tags tags exported? (:coerce Type value)))) #let [_ (log! (format "Definition " (%name full-name)))] _ (////statement.lift-generation (///generation.learn full-name valueN)) @@ -223,9 +223,10 @@ (def: (define-alias alias original) (-> Text Name (////analysis.Operation Any)) (do ///.monad - [[original-type original-annotations original-value] + [[exported? original-type original-annotations original-value] (//.lift (macro.find-def original))] - (module.define alias [original-type + (module.define alias [false + original-type (alias-annotations original) original-value]))) diff --git a/stdlib/source/lux/type/abstract.lux b/stdlib/source/lux/type/abstract.lux index 7c5804e04..70ec590da 100644 --- a/stdlib/source/lux/type/abstract.lux +++ b/stdlib/source/lux/type/abstract.lux @@ -33,7 +33,7 @@ (template: (!peek <source> <reference> <then>) (loop [entries <source>] (case entries - (#.Cons [head-name head-content] tail) + (#.Cons [head-name head] tail) (if (text;= <reference> head-name) <then> (recur tail)) @@ -44,13 +44,13 @@ (def: (peek-scopes-definition reference source) (-> Text (List [Text Definition]) (Stack Scope)) (!peek source reference - (let [[scope-type scope-anns scope-value] head-content] + (let [[exported? scope-type scope-anns scope-value] head] (:coerce (Stack Scope) scope-value)))) (def: (peek-scopes reference definition-reference source) (-> Text Text (List [Text Module]) (Stack Scope)) (!peek source reference - (peek-scopes-definition definition-reference (get@ #.definitions head-content)))) + (peek-scopes-definition definition-reference (get@ #.definitions head)))) (exception: #export (no-active-scopes) "") @@ -77,11 +77,11 @@ (template: (!push <source> <reference> <then>) (loop [entries <source>] (case entries - (#.Cons [head-name head-content] tail) + (#.Cons [head-name head] tail) (if (text;= <reference> head-name) (#.Cons [head-name <then>] tail) - (#.Cons [head-name head-content] + (#.Cons [head-name head] (recur tail))) #.Nil @@ -90,15 +90,16 @@ (def: (push-scope-definition reference scope source) (-> Text Scope (List [Text Definition]) (List [Text Definition])) (!push source reference - (let [[scopes-type scopes-anns scopes-value] head-content] - [scopes-type + (let [[exported? scopes-type scopes-anns scopes-value] head] + [exported? + scopes-type scopes-anns (stack.push scope (:coerce (Stack Scope) scopes-value))]))) (def: (push-scope [module-reference definition-reference] scope source) (-> Name Scope (List [Text Module]) (List [Text Module])) (!push source module-reference - (|> head-content (update@ #.definitions (push-scope-definition definition-reference scope))))) + (|> head (update@ #.definitions (push-scope-definition definition-reference scope))))) (def: (push! scope) (-> Scope (Meta Any)) @@ -111,8 +112,9 @@ (def: (pop-scope-definition reference source) (-> Text (List [Text Definition]) (List [Text Definition])) (!push source reference - (let [[scopes-type scopes-anns scopes-value] head-content] - [scopes-type + (let [[exported? scopes-type scopes-anns scopes-value] head] + [exported? + scopes-type scopes-anns (let [current-scopes (:coerce (Stack Scope) scopes-value)] (case (stack.pop current-scopes) @@ -125,7 +127,7 @@ (def: (pop-scope [module-reference definition-reference] source) (-> Name (List [Text Module]) (List [Text Module])) (!push source module-reference - (|> head-content (update@ #.definitions (pop-scope-definition definition-reference))))) + (|> head (update@ #.definitions (pop-scope-definition definition-reference))))) (syntax: (pop!) (function (_ compiler) diff --git a/stdlib/source/lux/type/implicit.lux b/stdlib/source/lux/type/implicit.lux index 5e72b7a79..90fd32c1c 100644 --- a/stdlib/source/lux/type/implicit.lux +++ b/stdlib/source/lux/type/implicit.lux @@ -114,9 +114,9 @@ (def: (prepare-definitions this-module-name definitions) (-> Text (List [Text Definition]) (List [Name Type])) (|> definitions - (list.filter (function (_ [name [def-type def-anns def-value]]) + (list.filter (function (_ [name [exported? def-type def-anns def-value]]) (macro.structure? def-anns))) - (list@map (function (_ [name [def-type def-anns def-value]]) + (list@map (function (_ [name [exported? def-type def-anns def-value]]) [[this-module-name name] def-type])))) (def: local-env diff --git a/stdlib/source/test/lux/tool/compiler/phase/analysis/reference.lux b/stdlib/source/test/lux/tool/compiler/phase/analysis/reference.lux index 7356b9fad..5d8782a4f 100644 --- a/stdlib/source/test/lux/tool/compiler/phase/analysis/reference.lux +++ b/stdlib/source/test/lux/tool/compiler/phase/analysis/reference.lux @@ -46,11 +46,7 @@ (-> Text [Bit Text] [Bit Text] Check Bit) (|> (do ///.monad [_ (//module.with-module 0 def-module - (//module.define var-name [Any - (if export? - (' {#.export? #1}) - (' {})) - []]))] + (//module.define var-name [export? Any (' {}) []]))] (//module.with-module 0 dependent-module (do @ [_ (if import? @@ -86,7 +82,7 @@ (_.test "Can analyse definition (in the same module)." (let [def-name [def-module var-name]] (|> (do ///.monad - [_ (//module.define var-name [expectedT (' {}) []])] + [_ (//module.define var-name [false expectedT (' {}) []])] (//type.with-inference (_primitive.phase (code.identifier def-name)))) (//module.with-module 0 def-module) |