From e2500061ed74ffccb299c2923894dd549238112b Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 20 Oct 2017 20:36:58 -0400 Subject: - Re-named "Host" to "Primitive". --- lux-mode/lux-mode.el | 16 +++---- luxc/src/lux/analyser/base.clj | 2 +- luxc/src/lux/analyser/case.clj | 10 ++--- luxc/src/lux/analyser/proc/js.clj | 20 ++++----- luxc/src/lux/analyser/proc/jvm.clj | 74 ++++++++++++++++---------------- luxc/src/lux/base.clj | 2 +- luxc/src/lux/compiler/cache/type.clj | 4 +- luxc/src/lux/compiler/jvm/proc/host.clj | 18 ++++---- luxc/src/lux/host.clj | 6 +-- luxc/src/lux/type.clj | 36 ++++++++-------- luxc/src/lux/type/host.clj | 38 ++++++++-------- stdlib/source/lux.lux | 56 ++++++++++++------------ stdlib/source/lux/concurrency/atom.lux | 2 +- stdlib/source/lux/host.js.lux | 2 +- stdlib/source/lux/host.jvm.lux | 30 ++++++------- stdlib/source/lux/meta/poly.lux | 20 ++++----- stdlib/source/lux/meta/poly/eq.lux | 2 +- stdlib/source/lux/meta/type.lux | 20 ++++----- stdlib/source/lux/meta/type/check.lux | 6 +-- stdlib/source/lux/meta/type/object.lux | 6 +-- stdlib/source/lux/meta/type/opaque.lux | 2 +- stdlib/source/lux/meta/type/unit.lux | 4 +- stdlib/source/lux/world/blob.jvm.lux | 2 +- stdlib/test/test/lux/meta/type/check.lux | 22 +++++----- 24 files changed, 200 insertions(+), 200 deletions(-) diff --git a/lux-mode/lux-mode.el b/lux-mode/lux-mode.el index da60f5699..ed440db65 100644 --- a/lux-mode/lux-mode.el +++ b/lux-mode/lux-mode.el @@ -230,7 +230,7 @@ Called by `imenu--generic-function'." "exec" "let" "if" "cond" "do" "be" "open" "loop" "recur" "comment" "for" "list" "list&" "io" "sequence" "tree" "get@" "set@" "update@" "|>" "|>." "<|" "<|." "_$" "$_" "~" "~@" "~'" "::" ":::" - "|" "&" "->" "All" "Ex" "Rec" "host" "$" "type" + "|" "&" "->" "All" "Ex" "Rec" "primitive" "$" "type" "^" "^or" "^slots" "^multi" "^~" "^@" "^template" "^open" "^|>" "^stream&" "^regex" "bin" "oct" "hex" "pre" "post" @@ -244,23 +244,23 @@ Called by `imenu--generic-function'." ) t) "\\>") 1 font-lock-builtin-face) - ; Bool literals + ; Bool literals (,(concat "\\<" (regexp-opt '("true" "false") t) "\\>") 0 font-lock-constant-face) - ; Nat literals + ; Nat literals ("\\<\\+\\(0\\|[1-9][0-9_]*\\)\\>" 0 font-lock-constant-face) - ; Int|Frac literals + ; Int|Frac literals ("\\<-?\\(0\\|[1-9][0-9_]*\\)\\(\\.[0-9_]+\\)?\\>" 0 font-lock-constant-face) ("\\<-?\\(0\\|[1-9][0-9_]*\\)\\(\\.[0-9_]+\\(\\(e\\|E\\)\\(-\\|\\+\\)?[1-9][0-9_]*\\)?\\)?\\>" 0 font-lock-constant-face) - ; Frac "ratio" literals + ; Frac "ratio" literals ("\\<-?\\(0\\|[1-9][0-9_]*\\)/[1-9][0-9_]*\\>" 0 font-lock-constant-face) - ; Deg literals + ; Deg literals ("\\<\\(\\.[0-9_]+\\)\\>" 0 font-lock-constant-face) - ; Tags + ; Tags ("#;[a-zA-Z0-9-\\+_=!@\\$%\\^&\\*<>\.,/\\\\\\|':~\\?]+" 0 font-lock-type-face) ("#;;[a-zA-Z0-9-\\+_=!@\\$%\\^&\\*<>\.,/\\\\\\|':~\\?]+" 0 font-lock-type-face) ("#[a-zA-Z0-9-\\+_=!@\\$%\\^&\\*<>\.,/\\\\\\|':~\\?]+\\(;[a-zA-Z0-9-\\+_=!@\\$%\\^&\\*<>\.,/\\\\\\|':~\\?]+\\)?" 0 font-lock-type-face) @@ -368,7 +368,7 @@ This function also returns nil meaning don't specify the indentation." "Call `put-lux-indent' on a series, KVS." `(progn ,@(mapcar (lambda (x) `(put-lux-indent - (quote ,(first x)) ,(second x))) + (quote ,(first x)) ,(second x))) kvs))) (define-lux-indent diff --git a/luxc/src/lux/analyser/base.clj b/luxc/src/lux/analyser/base.clj index 9f44db3af..8c82fe1cf 100644 --- a/luxc/src/lux/analyser/base.clj +++ b/luxc/src/lux/analyser/base.clj @@ -74,7 +74,7 @@ (return ?module))] (return (&/T [module* ?name])))) -(let [tag-names #{"Host" "Void" "Unit" "Sum" "Product" "Function" "Bound" "Var" "Ex" "UnivQ" "ExQ" "Apply" "Named"}] +(let [tag-names #{"Primitive" "Void" "Unit" "Sum" "Product" "Function" "Bound" "Var" "Ex" "UnivQ" "ExQ" "Apply" "Named"}] (defn type-tag? [module name] (and (= "lux" module) (contains? tag-names name)))) diff --git a/luxc/src/lux/analyser/case.clj b/luxc/src/lux/analyser/case.clj index a8fdd6f18..434a0f78a 100644 --- a/luxc/src/lux/analyser/case.clj +++ b/luxc/src/lux/analyser/case.clj @@ -68,9 +68,9 @@ (&/$Bound (+ (* 2 level) bound-idx)) type) - (&/$Host ?name ?params) - (&/$Host ?name (&/|map (partial clean! level ?tid bound-idx) - ?params)) + (&/$Primitive ?name ?params) + (&/$Primitive ?name (&/|map (partial clean! level ?tid bound-idx) + ?params)) (&/$Function ?arg ?return) (&/$Function (clean! level ?tid bound-idx ?arg) @@ -102,8 +102,8 @@ (defn beta-reduce! [level env type] (|case type - (&/$Host ?name ?params) - (&/$Host ?name (&/|map (partial beta-reduce! level env) ?params)) + (&/$Primitive ?name ?params) + (&/$Primitive ?name (&/|map (partial beta-reduce! level env) ?params)) (&/$Sum ?left ?right) (&/$Sum (beta-reduce! level env ?left) diff --git a/luxc/src/lux/analyser/proc/js.clj b/luxc/src/lux/analyser/proc/js.clj index 33fa7816d..8b218ee43 100644 --- a/luxc/src/lux/analyser/proc/js.clj +++ b/luxc/src/lux/analyser/proc/js.clj @@ -10,9 +10,9 @@ (do-template [ ] (defn [analyse exo-type ?values] (|do [:let [(&/$Cons ?function ?args) ?values] - =function (&&/analyse-1 analyse (&/$Host "function" &/$Nil) ?function) + =function (&&/analyse-1 analyse (&/$Primitive "function" &/$Nil) ?function) =args (&/map% (partial &&/analyse-1+ analyse) ?args) - _ (&type/check exo-type (&/$Host "object" &/$Nil)) + _ (&type/check exo-type (&/$Primitive "object" &/$Nil)) _cursor &/cursor] (return (&/|list (&&/|meta exo-type _cursor (&&/$proc (&/T ["js" ]) (&/$Cons =function =args) (&/|list))))))) @@ -23,17 +23,17 @@ (defn ^:private analyse-js-object-call [analyse exo-type ?values] (|do [:let [(&/$Cons ?object (&/$Cons ?field ?args)) ?values] - =object (&&/analyse-1 analyse (&/$Host "object" &/$Nil) ?object) + =object (&&/analyse-1 analyse (&/$Primitive "object" &/$Nil) ?object) =field (&&/analyse-1 analyse &type/Text ?field) =args (&/map% (partial &&/analyse-1+ analyse) ?args) - _ (&type/check exo-type (&/$Host "object" &/$Nil)) + _ (&type/check exo-type (&/$Primitive "object" &/$Nil)) _cursor &/cursor] (return (&/|list (&&/|meta exo-type _cursor (&&/$proc (&/T ["js" "object-call"]) (&/$Cons =object (&/$Cons =field =args)) (&/|list))))))) (defn ^:private analyse-js-ref [analyse exo-type ?values] (|do [:let [(&/$Cons [_ (&/$Text ?ref-name)] (&/$Nil)) ?values] - _ (&type/check exo-type (&/$Host "object" &/$Nil)) + _ (&type/check exo-type (&/$Primitive "object" &/$Nil)) _cursor &/cursor] (return (&/|list (&&/|meta exo-type _cursor (&&/$proc (&/T ["js" "ref"]) (&/|list) (&/|list ?ref-name))))))) @@ -41,9 +41,9 @@ (do-template [ ] (defn [analyse exo-type ?values] (|do [:let [(&/$Cons ?object (&/$Cons ?field (&/$Nil))) ?values] - =object (&&/analyse-1 analyse (&/$Host "object" &/$Nil) ?object) + =object (&&/analyse-1 analyse (&/$Primitive "object" &/$Nil) ?object) =field (&&/analyse-1 analyse &type/Text ?field) - _ (&type/check exo-type (&/$Host "object" &/$Nil)) + _ (&type/check exo-type (&/$Primitive "object" &/$Nil)) _cursor &/cursor] (return (&/|list (&&/|meta exo-type _cursor (&&/$proc (&/T ["js" ]) (&/|list =object =field) (&/|list))))))) @@ -54,10 +54,10 @@ (defn ^:private analyse-js-set-field [analyse exo-type ?values] (|do [:let [(&/$Cons ?object (&/$Cons ?field (&/$Cons ?value (&/$Nil)))) ?values] - =object (&&/analyse-1 analyse (&/$Host "object" &/$Nil) ?object) + =object (&&/analyse-1 analyse (&/$Primitive "object" &/$Nil) ?object) =field (&&/analyse-1 analyse &type/Text ?field) =value (&&/analyse-1+ analyse ?value) - _ (&type/check exo-type (&/$Host "object" &/$Nil)) + _ (&type/check exo-type (&/$Primitive "object" &/$Nil)) _cursor &/cursor] (return (&/|list (&&/|meta exo-type _cursor (&&/$proc (&/T ["js" "set-field"]) (&/|list =object =field =value) (&/|list))))))) @@ -65,7 +65,7 @@ (do-template [ ] (defn [analyse exo-type ?values] (|do [:let [(&/$Nil) ?values] - :let [output-type (&/$Host &/$Nil)] + :let [output-type (&/$Primitive &/$Nil)] _ (&type/check exo-type output-type) _cursor &/cursor] (return (&/|list (&&/|meta exo-type _cursor diff --git a/luxc/src/lux/analyser/proc/jvm.clj b/luxc/src/lux/analyser/proc/jvm.clj index dc3f8d587..cd3b8f545 100644 --- a/luxc/src/lux/analyser/proc/jvm.clj +++ b/luxc/src/lux/analyser/proc/jvm.clj @@ -21,7 +21,7 @@ (defn ^:private ensure-object [type] "(-> Type (Lux (, Text (List Type))))" (|case type - (&/$Host payload) + (&/$Primitive payload) (return payload) (&/$Var id) @@ -49,8 +49,8 @@ (defn ^:private as-object [type] "(-> Type Type)" (|case type - (&/$Host class params) - (&/$Host (&host-type/as-obj class) params) + (&/$Primitive class params) + (&/$Primitive (&host-type/as-obj class) params) _ type)) @@ -72,8 +72,8 @@ (defn ^:private as-otype+ [type] "(-> Type Type)" (|case type - (&/$Host name params) - (&/$Host (as-otype name) params) + (&/$Primitive name params) + (&/$Primitive (as-otype name) params) _ type)) @@ -104,14 +104,14 @@ _ base-type)) - (&/$Host class-name type-args) + (&/$Primitive class-name type-args) type-args)) ;; [Resources] (defn ^:private analyse-field-access-helper [obj-type gvars gtype] "(-> Type (List (^ java.lang.reflect.Type)) (^ java.lang.reflect.Type) (Lux Type))" (|case obj-type - (&/$Host class targs) + (&/$Primitive class targs) (if (= (&/|length targs) (&/|length gvars)) (|let [gtype-env (&/fold2 (fn [m ^TypeVariable g t] (&/$Cons (&/T [(.getName g) t]) m)) (&/|table) @@ -186,22 +186,22 @@ (&/$GenericClass name params) (case name - "boolean" (return (&/$Host "java.lang.Boolean" &/$Nil)) - "byte" (return (&/$Host "java.lang.Byte" &/$Nil)) - "short" (return (&/$Host "java.lang.Short" &/$Nil)) - "int" (return (&/$Host "java.lang.Integer" &/$Nil)) - "long" (return (&/$Host "java.lang.Long" &/$Nil)) - "float" (return (&/$Host "java.lang.Float" &/$Nil)) - "double" (return (&/$Host "java.lang.Double" &/$Nil)) - "char" (return (&/$Host "java.lang.Character" &/$Nil)) + "boolean" (return (&/$Primitive "java.lang.Boolean" &/$Nil)) + "byte" (return (&/$Primitive "java.lang.Byte" &/$Nil)) + "short" (return (&/$Primitive "java.lang.Short" &/$Nil)) + "int" (return (&/$Primitive "java.lang.Integer" &/$Nil)) + "long" (return (&/$Primitive "java.lang.Long" &/$Nil)) + "float" (return (&/$Primitive "java.lang.Float" &/$Nil)) + "double" (return (&/$Primitive "java.lang.Double" &/$Nil)) + "char" (return (&/$Primitive "java.lang.Character" &/$Nil)) "void" (return &/$Unit) ;; else (|do [=params (&/map% (partial generic-class->type env) params)] - (return (&/$Host name =params)))) + (return (&/$Primitive name =params)))) (&/$GenericArray param) (|do [=param (generic-class->type env param)] - (return (&/$Host &host-type/array-data-tag (&/|list =param)))) + (return (&/$Primitive &host-type/array-data-tag (&/|list =param)))) (&/$GenericWildcard _) (return (&/$ExQ &/$Nil (&/$Bound 1))) @@ -260,7 +260,7 @@ (defn ^:private analyse-method [analyse class-decl class-env all-supers method] "(-> Analyser ClassDecl (List (, TypeVar Type)) (List SuperClassDecl) MethodSyntax (Lux MethodAnalysis))" (|let [[?cname ?cparams] class-decl - class-type (&/$Host ?cname (&/|map &/|second class-env))] + class-type (&/$Primitive ?cname (&/|map &/|second class-env))] (|case method (&/$ConstructorMethodSyntax =privacy-modifier ?strict ?anns ?gvars ?exceptions ?inputs ?ctor-args ?body) (|do [method-env (make-type-env ?gvars) @@ -383,10 +383,10 @@ )) (do-template [ ] - (let [output-type (&/$Host &/$Nil)] + (let [output-type (&/$Primitive &/$Nil)] (defn [analyse exo-type _?value] (|do [:let [(&/$Cons ?value (&/$Nil)) _?value] - =value (&&/analyse-1 analyse (&/$Host &/$Nil) ?value) + =value (&&/analyse-1 analyse (&/$Primitive &/$Nil) ?value) _ (&type/check exo-type output-type) _cursor &/cursor] (return (&/|list (&&/|meta output-type _cursor (&&/$proc (&/T ["jvm" ]) (&/|list =value) (&/|list)))))))) @@ -423,11 +423,11 @@ ) (do-template [ ] - (let [output-type (&/$Host &/$Nil)] + (let [output-type (&/$Primitive &/$Nil)] (defn [analyse exo-type ?values] (|do [:let [(&/$Cons ?value1 (&/$Cons ?value2 (&/$Nil))) ?values] - =value1 (&&/analyse-1 analyse (&/$Host &/$Nil) ?value1) - =value2 (&&/analyse-1 analyse (&/$Host &/$Nil) ?value2) + =value1 (&&/analyse-1 analyse (&/$Primitive &/$Nil) ?value1) + =value2 (&&/analyse-1 analyse (&/$Primitive &/$Nil) ?value2) _ (&type/check exo-type output-type) _cursor &/cursor] (return (&/|list (&&/|meta output-type _cursor (&&/$proc (&/T ["jvm" ]) (&/|list =value1 =value2) (&/|list)))))))) @@ -448,8 +448,8 @@ ) (do-template [ ] - (let [input-type (&/$Host &/$Nil) - output-type (&/$Host &/$Nil)] + (let [input-type (&/$Primitive &/$Nil) + output-type (&/$Primitive &/$Nil)] (defn [analyse exo-type ?values] (|do [:let [(&/$Cons x (&/$Cons y (&/$Nil))) ?values] =x (&&/analyse-1 analyse input-type x) @@ -503,8 +503,8 @@ (let [length-type &type/Nat idx-type &type/Nat] (do-template [ ] - (let [elem-type (&/$Host &/$Nil) - array-type (&/$Host &/$Nil)] + (let [elem-type (&/$Primitive &/$Nil) + array-type (&/$Primitive &/$Nil)] (defn [analyse exo-type ?values] (|do [:let [(&/$Cons length (&/$Nil)) ?values] =length (&&/analyse-1 analyse length-type length) @@ -558,7 +558,7 @@ &&a-parser/parse-gclass) gtype-env &/get-type-env =gclass (&host-type/instance-gtype &type/existential gtype-env gclass) - :let [array-type (&/$Host &host-type/array-data-tag (&/|list =gclass))] + :let [array-type (&/$Primitive &host-type/array-data-tag (&/|list =gclass))] =length (&&/analyse-1 analyse length-type length) _ (&type/check exo-type array-type) _cursor &/cursor] @@ -614,7 +614,7 @@ (defn ^:private analyse-jvm-null [analyse exo-type ?values] (|do [:let [(&/$Nil) ?values] - :let [output-type (&/$Host &host-type/null-data-tag &/$Nil)] + :let [output-type (&/$Primitive &host-type/null-data-tag &/$Nil)] _ (&type/check exo-type output-type) _cursor &/cursor] (return (&/|list (&&/|meta exo-type _cursor @@ -632,7 +632,7 @@ (defn ^:private analyse-jvm-throw [analyse exo-type ?values] (|do [:let [(&/$Cons ?ex (&/$Nil)) ?values] =ex (&&/analyse-1+ analyse ?ex) - _ (&type/check (&/$Host "java.lang.Throwable" &/$Nil) (&&/expr-type* =ex)) + _ (&type/check (&/$Primitive "java.lang.Throwable" &/$Nil) (&&/expr-type* =ex)) [throw-class throw-params] (ensure-object (&&/expr-type* =ex)) _cursor &/cursor _ (&type/check exo-type &type/Bottom)] @@ -717,7 +717,7 @@ (return (&/T [==gret ==args]))))) )) -(let [dummy-type-param (&/$Host "java.lang.Object" &/$Nil)] +(let [dummy-type-param (&/$Primitive "java.lang.Object" &/$Nil)] (do-template [ ] (defn [analyse exo-type class method classes ?values] (|do [!class! (&/de-alias-class class) @@ -735,10 +735,10 @@ (&host/lookup-virtual-method class-loader !class! method classes)) =object (&&/analyse-1+ analyse object) [sub-class sub-params] (ensure-object (&&/expr-type* =object)) - (&/$Host super-class* super-params*) (&host-type/->super-type &type/existential class-loader !class! (if (= sub-class class) - !class! - sub-class) - sub-params) + (&/$Primitive super-class* super-params*) (&host-type/->super-type &type/existential class-loader !class! (if (= sub-class class) + !class! + sub-class) + sub-params) :let [gtype-env (&/fold2 (fn [m ^TypeVariable g t] (&/$Cons (&/T [(.getName g) t]) m)) (&/|table) parent-gvars @@ -811,7 +811,7 @@ (return nil)) (catch Exception e (&/fail-with-loc (str "[Analyser Error] Unknown class: " _class-name)))) - :let [output-type (&/$Host "java.lang.Class" (&/|list (&/$Host _class-name (&/|list))))] + :let [output-type (&/$Primitive "java.lang.Class" (&/|list (&/$Primitive _class-name (&/|list))))] _ (&type/check exo-type output-type) _cursor &/cursor] (return (&/|list (&&/|meta output-type _cursor @@ -866,7 +866,7 @@ :let [name (->> scope &/|reverse &/|tail &host/location) class-decl (&/T [name &/$Nil]) anon-class (str (string/replace module "/" ".") "." name) - anon-class-type (&/$Host anon-class &/$Nil)] + anon-class-type (&/$Primitive anon-class &/$Nil)] =ctor-args (&/map% (fn [ctor-arg] (|let [[arg-type arg-term] ctor-arg] (|do [=arg-term (&&/analyse-1+ analyse arg-term)] diff --git a/luxc/src/lux/base.clj b/luxc/src/lux/base.clj index 1281df4e6..3bf0eaf08 100644 --- a/luxc/src/lux/base.clj +++ b/luxc/src/lux/base.clj @@ -85,7 +85,7 @@ ;; Type (defvariant - ("Host" 2) + ("Primitive" 2) ("Void" 0) ("Unit" 0) ("Sum" 2) diff --git a/luxc/src/lux/compiler/cache/type.clj b/luxc/src/lux/compiler/cache/type.clj index 04fb01540..88e1d5a03 100644 --- a/luxc/src/lux/compiler/cache/type.clj +++ b/luxc/src/lux/compiler/cache/type.clj @@ -24,7 +24,7 @@ (if (clojure.lang.Util/identical &type/Type type) "T" (|case type - (&/$Host name params) + (&/$Primitive name params) (str "^" name stop (serialize-list serialize-type params)) (&/$Void) @@ -137,7 +137,7 @@ (when (.startsWith input "^") (let [[name ^String input*] (.split (.substring input 1) stop 2)] (when-let [[params ^String input*] (deserialize-list input*)] - [(&/$Host name params) input*])))) + [(&/$Primitive name params) input*])))) (defn deserialize-type "(-> Text Type)" diff --git a/luxc/src/lux/compiler/jvm/proc/host.clj b/luxc/src/lux/compiler/jvm/proc/host.clj index 18b140176..3d68bda68 100644 --- a/luxc/src/lux/compiler/jvm/proc/host.clj +++ b/luxc/src/lux/compiler/jvm/proc/host.clj @@ -51,31 +51,31 @@ (&/$Unit) (.visitLdcInsn *writer* &/unit-tag) - (&/$Host "boolean" (&/$Nil)) + (&/$Primitive "boolean" (&/$Nil)) (.visitMethodInsn *writer* Opcodes/INVOKESTATIC (&host-generics/->bytecode-class-name boolean-class) "valueOf" (str "(Z)" (&host-generics/->type-signature boolean-class))) - (&/$Host "byte" (&/$Nil)) + (&/$Primitive "byte" (&/$Nil)) (.visitMethodInsn *writer* Opcodes/INVOKESTATIC (&host-generics/->bytecode-class-name byte-class) "valueOf" (str "(B)" (&host-generics/->type-signature byte-class))) - (&/$Host "short" (&/$Nil)) + (&/$Primitive "short" (&/$Nil)) (.visitMethodInsn *writer* Opcodes/INVOKESTATIC (&host-generics/->bytecode-class-name short-class) "valueOf" (str "(S)" (&host-generics/->type-signature short-class))) - (&/$Host "int" (&/$Nil)) + (&/$Primitive "int" (&/$Nil)) (.visitMethodInsn *writer* Opcodes/INVOKESTATIC (&host-generics/->bytecode-class-name int-class) "valueOf" (str "(I)" (&host-generics/->type-signature int-class))) - (&/$Host "long" (&/$Nil)) + (&/$Primitive "long" (&/$Nil)) (.visitMethodInsn *writer* Opcodes/INVOKESTATIC (&host-generics/->bytecode-class-name long-class) "valueOf" (str "(J)" (&host-generics/->type-signature long-class))) - (&/$Host "float" (&/$Nil)) + (&/$Primitive "float" (&/$Nil)) (.visitMethodInsn *writer* Opcodes/INVOKESTATIC (&host-generics/->bytecode-class-name float-class) "valueOf" (str "(F)" (&host-generics/->type-signature float-class))) - (&/$Host "double" (&/$Nil)) + (&/$Primitive "double" (&/$Nil)) (.visitMethodInsn *writer* Opcodes/INVOKESTATIC (&host-generics/->bytecode-class-name double-class) "valueOf" (str "(D)" (&host-generics/->type-signature double-class))) - (&/$Host "char" (&/$Nil)) + (&/$Primitive "char" (&/$Nil)) (.visitMethodInsn *writer* Opcodes/INVOKESTATIC (&host-generics/->bytecode-class-name char-class) "valueOf" (str "(C)" (&host-generics/->type-signature char-class))) - (&/$Host _ _) + (&/$Primitive _ _) nil (&/$Named ?name ?type) diff --git a/luxc/src/lux/host.clj b/luxc/src/lux/host.clj index 7ee553d53..97d2bd69d 100644 --- a/luxc/src/lux/host.clj +++ b/luxc/src/lux/host.clj @@ -30,7 +30,7 @@ (defn unfold-array [type] "(-> Type (, Int Type))" (|case type - (&/$Host "#Array" (&/$Cons param (&/$Nil))) + (&/$Primitive "#Array" (&/$Cons param (&/$Nil))) (|let [[count inner] (unfold-array param)] (&/T [(inc count) inner])) @@ -42,10 +42,10 @@ (defn ->java-sig [^objects type] "(-> Type (Lux Text))" (|case type - (&/$Host ?name params) + (&/$Primitive ?name params) (cond (= &host-type/array-data-tag ?name) (|do [:let [[level base] (unfold-array type)] base-sig (|case base - (&/$Host base-class _) + (&/$Primitive base-class _) (return (&host-generics/->type-signature base-class)) _ diff --git a/luxc/src/lux/type.clj b/luxc/src/lux/type.clj index 6de9b7086..0834db3a6 100644 --- a/luxc/src/lux/type.clj +++ b/luxc/src/lux/type.clj @@ -23,17 +23,17 @@ (def empty-env &/$Nil) -(def Bool (&/$Named (&/T ["lux" "Bool"]) (&/$Host "#Bool" &/$Nil))) -(def Nat (&/$Named (&/T ["lux" "Nat"]) (&/$Host &&host/nat-data-tag &/$Nil))) -(def Deg (&/$Named (&/T ["lux" "Deg"]) (&/$Host &&host/deg-data-tag &/$Nil))) -(def Int (&/$Named (&/T ["lux" "Int"]) (&/$Host "#Int" &/$Nil))) -(def Frac (&/$Named (&/T ["lux" "Frac"]) (&/$Host "#Frac" &/$Nil))) -(def Text (&/$Named (&/T ["lux" "Text"]) (&/$Host "#Text" &/$Nil))) +(def Bool (&/$Named (&/T ["lux" "Bool"]) (&/$Primitive "#Bool" &/$Nil))) +(def Nat (&/$Named (&/T ["lux" "Nat"]) (&/$Primitive &&host/nat-data-tag &/$Nil))) +(def Deg (&/$Named (&/T ["lux" "Deg"]) (&/$Primitive &&host/deg-data-tag &/$Nil))) +(def Int (&/$Named (&/T ["lux" "Int"]) (&/$Primitive "#Int" &/$Nil))) +(def Frac (&/$Named (&/T ["lux" "Frac"]) (&/$Primitive "#Frac" &/$Nil))) +(def Text (&/$Named (&/T ["lux" "Text"]) (&/$Primitive "#Text" &/$Nil))) (def Ident (&/$Named (&/T ["lux" "Ident"]) (&/$Product Text Text))) (do-template [ ] (defn [elem-type] - (&/$Host (&/|list elem-type))) + (&/$Primitive (&/|list elem-type))) Array "#Array" Atom "#Atom" @@ -83,7 +83,7 @@ (&/$Apply &/$Void (&/$UnivQ empty-env (&/$Sum - ;; Host + ;; Primitive (&/$Product Text TypeList) (&/$Sum ;; Void @@ -222,7 +222,7 @@ (&/$None) (return* (&/update$ &/$type-context (fn [ts] (&/update$ &/$var-bindings #(&/|put id (&/$Some type) %) - ts)) + ts)) state) nil)) ((&/fail-with-loc (str "[Type Error] Unknown type-var: " id " | " (->> state (&/get$ &/$type-context) (&/get$ &/$var-bindings) &/|length))) @@ -345,9 +345,9 @@ (return type))) ) - (&/$Host ?name ?params) + (&/$Primitive ?name ?params) (|do [=params (&/map% (partial clean* ?tid) ?params)] - (return (&/$Host ?name =params))) + (return (&/$Primitive ?name =params))) (&/$Function ?arg ?return) (|do [=arg (clean* ?tid ?arg) @@ -456,13 +456,13 @@ (defn show-type [^objects type] (|case type - (&/$Host name params) + (&/$Primitive name params) (|case params (&/$Nil) - (str "(host " name ")") + (str "(primitive " name ")") _ - (str "(host " name " " (->> params (&/|map show-type) (&/|interpose " ") (&/fold str "")) ")")) + (str "(primitive " name " " (->> params (&/|map show-type) (&/|interpose " ") (&/fold str "")) ")")) (&/$Void) "Void" @@ -514,7 +514,7 @@ (and (= ?xmodule ?ymodule) (= ?xname ?yname)) - [(&/$Host xname xparams) (&/$Host yname yparams)] + [(&/$Primitive xname xparams) (&/$Primitive yname yparams)] (and (.equals ^Object xname yname) (= (&/|length xparams) (&/|length yparams)) (&/fold2 #(and %1 (type= %2 %3)) true xparams yparams)) @@ -604,8 +604,8 @@ (defn beta-reduce [env type] (|case type - (&/$Host ?name ?params) - (&/$Host ?name (&/|map (partial beta-reduce env) ?params)) + (&/$Primitive ?name ?params) + (&/$Primitive ?name (&/|map (partial beta-reduce env) ?params)) (&/$Sum ?left ?right) (&/$Sum (beta-reduce env ?left) (beta-reduce env ?right)) @@ -841,7 +841,7 @@ actual* (apply-type actual $arg)] (check* fixpoints invariant?? expected actual*)) - [(&/$Host e!data) (&/$Host a!data)] + [(&/$Primitive e!data) (&/$Primitive a!data)] (|do [? &/jvm?] (if ? (|do [class-loader &/loader] diff --git a/luxc/src/lux/type/host.clj b/luxc/src/lux/type/host.clj index 74ef262c6..c4d4ef243 100644 --- a/luxc/src/lux/type/host.clj +++ b/luxc/src/lux/type/host.clj @@ -77,18 +77,18 @@ (let [gclass-name (.getName class)] (case gclass-name ("[Z" "[B" "[S" "[I" "[J" "[F" "[D" "[C") - (&/$Host gclass-name (&/|list)) + (&/$Primitive gclass-name (&/|list)) ;; else (if-let [[_ _ arr-obrackets arr-obase simple-base arr-pbrackets arr-pbase] (re-find class-name-re gclass-name)] (let [base (or arr-obase simple-base (jprim->lprim arr-pbase))] (if (.equals "void" base) &/$Unit - (reduce (fn [inner _] (&/$Host array-data-tag (&/|list inner))) - (&/$Host base (try (-> (Class/forName base) .getTypeParameters - seq count (repeat (&/$Host "java.lang.Object" &/$Nil)) - &/->list) - (catch Exception e - (&/|list)))) + (reduce (fn [inner _] (&/$Primitive array-data-tag (&/|list inner))) + (&/$Primitive base (try (-> (Class/forName base) .getTypeParameters + seq count (repeat (&/$Primitive "java.lang.Object" &/$Nil)) + &/->list) + (catch Exception e + (&/|list)))) (range (count (or arr-obrackets arr-pbrackets ""))))) )))))) @@ -99,7 +99,7 @@ (instance? GenericArrayType refl-type) (|do [inner-type (instance-param existential matchings (.getGenericComponentType ^GenericArrayType refl-type))] - (return (&/$Host array-data-tag (&/|list inner-type)))) + (return (&/$Primitive array-data-tag (&/|list inner-type)))) (instance? ParameterizedType refl-type) (|do [:let [refl-type* ^ParameterizedType refl-type] @@ -107,8 +107,8 @@ .getActualTypeArguments seq &/->list (&/map% (partial instance-param existential matchings)))] - (return (&/$Host (->> refl-type* ^Class (.getRawType) .getName) - params*))) + (return (&/$Primitive (->> refl-type* ^Class (.getRawType) .getName) + params*))) (instance? TypeVariable refl-type) (let [gvar (.getName ^TypeVariable refl-type)] @@ -127,10 +127,10 @@ (defn principal-class [refl-type] (cond (instance? Class refl-type) (|case (class->type refl-type) - (&/$Host "#Array" (&/$Cons (&/$Host class-name _) (&/$Nil))) + (&/$Primitive "#Array" (&/$Cons (&/$Primitive class-name _) (&/$Nil))) (str "[" (&host-generics/->type-signature class-name)) - (&/$Host class-name _) + (&/$Primitive class-name _) (&host-generics/->type-signature class-name) (&/$Unit) @@ -157,7 +157,7 @@ (|case gtype (&/$GenericArray component-type) (|do [inner-type (instance-gtype existential matchings component-type)] - (return (&/$Host array-data-tag (&/|list inner-type)))) + (return (&/$Primitive array-data-tag (&/|list inner-type)))) (&/$GenericClass type-name type-params) ;; When referring to type-parameters during class or method @@ -171,7 +171,7 @@ (return m-type) (|do [params* (&/map% (partial instance-gtype existential matchings) type-params)] - (return (&/$Host type-name params*)))) + (return (&/$Primitive type-name params*)))) (&/$GenericTypeVar var-name) (if-let [m-type (&/|get var-name matchings)] @@ -232,7 +232,7 @@ (if (.isAssignableFrom super-class+ sub-class+) (let [lineage (trace-lineage sub-class+ super-class+)] (|do [[^Class sub-class* sub-params*] (raise existential lineage sub-class+ sub-params)] - (return (&/$Host (.getName sub-class*) sub-params*)))) + (return (&/$Primitive (.getName sub-class*) sub-params*)))) (&/fail-with-loc (str "[Host Error] Classes do not have a subtyping relationship: " sub-class " super-type existential class-loader e!name a!name a!params)] - (check (&/$Host e!name e!params) actual*)) + (check (&/$Primitive e!name e!params) actual*)) :else - (check-error "" (&/$Host e!name e!params) (&/$Host a!name a!params)))) + (check-error "" (&/$Primitive e!name e!params) (&/$Primitive a!name a!params)))) (catch Exception e (throw e))))) diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index fd8948164..31e7fe01c 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -169,7 +169,7 @@ #Nil))))))]) ## (type: #rec Type -## (#Host Text (List Type)) +## (#Primitive Text (List Type)) ## #Void ## #Unit ## (#Sum Type Type) @@ -193,7 +193,7 @@ Type-Pair (+11 Void (+9 #Nil - (+3 ## "lux;Host" + (+3 ## "lux;Primitive" (+4 Text Type-List) (+3 ## "lux;Void" (+2) @@ -225,7 +225,7 @@ (#Cons [[dummy-cursor (+7 ["lux" "export?"])] [dummy-cursor (+0 true)]] (#Cons [[dummy-cursor (+7 ["lux" "tags"])] - [dummy-cursor (+9 (#Cons [dummy-cursor (+5 "Host")] + [dummy-cursor (+9 (#Cons [dummy-cursor (+5 "Primitive")] (#Cons [dummy-cursor (+5 "Void")] (#Cons [dummy-cursor (+5 "Unit")] (#Cons [dummy-cursor (+5 "Sum")] @@ -1944,21 +1944,21 @@ (wrap (wrap-meta (form$ (list (tag$ ["lux" "Record"]) (untemplate-list =fields)))))) )) -(macro:' #export (host tokens) +(macro:' #export (primitive tokens) (list [(tag$ ["lux" "doc"]) - (text$ "## Macro to treat host-types as Lux-types. - (host java.lang.Object) + (text$ "## Macro to treat define new primitive types. + (primitive java.lang.Object) - (host java.util.List [java.lang.Long])")]) + (primitive java.util.List [java.lang.Long])")]) (_lux_case tokens (#Cons [_ (#Symbol "" class-name)] #Nil) - (return (list (form$ (list (tag$ ["lux" "Host"]) (text$ class-name) (tag$ ["lux" "Nil"]))))) + (return (list (form$ (list (tag$ ["lux" "Primitive"]) (text$ class-name) (tag$ ["lux" "Nil"]))))) (#Cons [_ (#Symbol "" class-name)] (#Cons [_ (#Tuple params)] #Nil)) - (return (list (form$ (list (tag$ ["lux" "Host"]) (text$ class-name) (untemplate-list params))))) + (return (list (form$ (list (tag$ ["lux" "Primitive"]) (text$ class-name) (untemplate-list params))))) _ - (fail "Wrong syntax for host"))) + (fail "Wrong syntax for primitive"))) (def:'' (current-module-name state) #Nil @@ -2435,7 +2435,7 @@ (function' [state] (_lux_case state {#info info #source source #modules modules - #scopes scopes #type-context types #host host + #scopes scopes #type-context types #host host #seed seed #expected expected #cursor cursor #scope-type-vars scope-type-vars} @@ -4292,16 +4292,16 @@ _ (list))) -(def: (Type/show type) +(def: (type/show type) (-> Type Text) (case type - (#Host name params) + (#Primitive name params) (case params #;Nil name _ - ($_ text/compose "(" name " " (|> params (map Type/show) (interpose " ") reverse (fold text/compose "")) ")")) + ($_ text/compose "(" name " " (|> params (map type/show) (interpose " ") reverse (fold text/compose "")) ")")) #Void "Void" @@ -4310,13 +4310,13 @@ "Unit" (#Sum _) - ($_ text/compose "(| " (|> (flatten-variant type) (map Type/show) (interpose " ") reverse (fold text/compose "")) ")") + ($_ text/compose "(| " (|> (flatten-variant type) (map type/show) (interpose " ") reverse (fold text/compose "")) ")") (#Product _) - ($_ text/compose "[" (|> (flatten-tuple type) (map Type/show) (interpose " ") reverse (fold text/compose "")) "]") + ($_ text/compose "[" (|> (flatten-tuple type) (map type/show) (interpose " ") reverse (fold text/compose "")) "]") (#Function _) - ($_ text/compose "(-> " (|> (flatten-lambda type) (map Type/show) (interpose " ") reverse (fold text/compose "")) ")") + ($_ text/compose "(-> " (|> (flatten-lambda type) (map type/show) (interpose " ") reverse (fold text/compose "")) ")") (#Bound id) (nat/encode id) @@ -4328,16 +4328,16 @@ ($_ text/compose "⟨e:" (nat/encode id) "⟩") (#UnivQ env body) - ($_ text/compose "(All " (Type/show body) ")") + ($_ text/compose "(All " (type/show body) ")") (#ExQ env body) - ($_ text/compose "(Ex " (Type/show body) ")") + ($_ text/compose "(Ex " (type/show body) ")") (#Apply _) (let [[func args] (flatten-app type)] ($_ text/compose - "(" (Type/show func) " " - (|> args (map Type/show) (interpose " ") reverse (fold text/compose "")) + "(" (type/show func) " " + (|> args (map type/show) (interpose " ") reverse (fold text/compose "")) ")")) (#Named [prefix name] _) @@ -4366,7 +4366,7 @@ struct-evidence (resolve-type-tags init-type)] (case struct-evidence #;None - (fail (text/compose "Can only \"open\" structs: " (Type/show init-type))) + (fail (text/compose "Can only \"open\" structs: " (type/show init-type))) (#;Some tags&members) (do Monad @@ -4545,7 +4545,7 @@ (return (list/join decls'))) _ - (fail (text/compose "Can only \"open\" structs: " (Type/show struct-type))))) + (fail (text/compose "Can only \"open\" structs: " (type/show struct-type))))) _ (fail "Wrong syntax for open"))) @@ -4921,8 +4921,8 @@ (def: (beta-reduce env type) (-> (List Type) Type Type) (case type - (#;Host name params) - (#;Host name (list/map (beta-reduce env) params)) + (#;Primitive name params) + (#;Primitive name (list/map (beta-reduce env) params)) (^template [] ( left right) @@ -5191,8 +5191,8 @@ (def: (type-to-code type) (-> Type Code) (case type - (#Host name params) - (` (#Host (~ (text$ name)) (~ (untemplate-list (map type-to-code params))))) + (#Primitive name params) + (` (#Primitive (~ (text$ name)) (~ (untemplate-list (map type-to-code params))))) #Void (` #Void) @@ -5866,7 +5866,7 @@ (type: #export (Array a) {#;doc "Mutable arrays."} - (#;Host "#Array" (#;Cons a #;Nil))) + (#;Primitive "#Array" (#;Cons a #;Nil))) (def: target (Meta Text) diff --git a/stdlib/source/lux/concurrency/atom.lux b/stdlib/source/lux/concurrency/atom.lux index c9402ed80..aad81a791 100644 --- a/stdlib/source/lux/concurrency/atom.lux +++ b/stdlib/source/lux/concurrency/atom.lux @@ -5,7 +5,7 @@ (type: #export (Atom a) {#;doc "Atomic references that are safe to mutate concurrently."} - (#;Host "#Atom" (#;Cons a #;Nil))) + (#;Primitive "#Atom" (#;Cons a #;Nil))) (def: #export (atom value) (All [a] (-> a (Atom a))) diff --git a/stdlib/source/lux/host.js.lux b/stdlib/source/lux/host.js.lux index 4abafbdf3..85a1cca1e 100644 --- a/stdlib/source/lux/host.js.lux +++ b/stdlib/source/lux/host.js.lux @@ -9,7 +9,7 @@ )) (do-template [ ] - [(type: #export (#;Host #;Nil))] + [(type: #export (#;Primitive #;Nil))] [Object "object"] [Function "function"] diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux index 319615411..25876bad4 100644 --- a/stdlib/source/lux/host.jvm.lux +++ b/stdlib/source/lux/host.jvm.lux @@ -24,7 +24,7 @@ "To:" )} - (-> (host ) (host )) + (-> (primitive ) (primitive )) (_lux_proc ["jvm" ] [value]))] [b2l "b2l" java.lang.Byte java.lang.Long] @@ -107,7 +107,7 @@ {#class-name Text #class-params (List TypeParam)}) -(type: StackFrame (host java.lang.StackTraceElement)) +(type: StackFrame (primitive java.lang.StackTraceElement)) (type: StackTrace (Array StackFrame)) (type: SuperClassDecl @@ -284,7 +284,7 @@ [[name params] _ _] (let [=params (list/map (class->type' mode type-params in-array?) params)] - (` (host (~ (code;symbol ["" name])) [(~@ =params)]))))) + (` (primitive (~ (code;symbol ["" name])) [(~@ =params)]))))) (def: (class->type' mode type-params in-array? class) (-> Primitive-Mode (List TypeParam) Bool GenericType Code) @@ -334,7 +334,7 @@ (#;Cons bound1 _) (class->type #ManualPrM class-params bound1)))) class-params)] - (` (host (~ (code;symbol ["" class-name])) [(~@ =params)])))) + (` (primitive (~ (code;symbol ["" class-name])) [(~@ =params)])))) (def: empty-imports ClassImports @@ -1381,7 +1381,7 @@ (null? "YOLO") "=>" false)} - (-> (host java.lang.Object) Bool) + (-> (primitive java.lang.Object) Bool) (;_lux_proc ["jvm" "null?"] [obj])) (syntax: #export (??? expr) @@ -1436,7 +1436,7 @@ #;None (do @ [g!obj (meta;gensym "obj")] - (wrap (list (` (: (-> (host (~' java.lang.Object)) Bool) + (wrap (list (` (: (-> (primitive (~' java.lang.Object)) Bool) (function [(~ g!obj)] (;_lux_proc ["jvm" (~ (code;text (format "instanceof" ":" (simple-class$ (list) class))))] [(~ g!obj)]))))))) )) @@ -1470,7 +1470,7 @@ {#;type? true #;;jvm-class (~ (code;text full-name))} Type - (host (~ (code;symbol ["" full-name]))))) + (primitive (~ (code;symbol ["" full-name]))))) (#;Cons _) (let [params' (list/map (function [[p _]] (code;symbol ["" p])) params)] @@ -1479,8 +1479,8 @@ #;;jvm-class (~ (code;text full-name))} Type (All [(~@ params')] - (host (~ (code;symbol ["" full-name])) - [(~@ params')])))))))) + (primitive (~ (code;symbol ["" full-name])) + [(~@ params')])))))))) (def: (member-type-vars class-tvars member) (-> (List TypeParam) ImportMemberDecl (List TypeParam)) @@ -1552,7 +1552,7 @@ [return-type (let [g!temp (code;symbol ["" "Ω"])] (` (let [(~ g!temp) (~ return-term)] - (if (not (null? (:! (host (~' java.lang.Object)) + (if (not (null? (:! (primitive (~' java.lang.Object)) (~ g!temp)))) (~ g!temp) (error! "Cannot produce null references from method calls.")))))]) @@ -1679,13 +1679,13 @@ [#let [enum-type (: Code (case class-tvars #;Nil - (` (host (~ (code;symbol ["" full-name])))) + (` (primitive (~ (code;symbol ["" full-name])))) _ (let [=class-tvars (|> class-tvars (list;filter free-type-param?) (list/map type-param->type-arg))] - (` (All [(~@ =class-tvars)] (host (~ (code;symbol ["" full-name])) [(~@ =class-tvars)])))))) + (` (All [(~@ =class-tvars)] (primitive (~ (code;symbol ["" full-name])) [(~@ =class-tvars)])))))) getter-interop (: (-> Text Code) (function [name] (let [getter-name (code;symbol ["" (format method-prefix member-separator name)])] @@ -1827,11 +1827,11 @@ (member-def-interop type-params kind class =args member method-prefix)))) (def: (interface? class) - (All [a] (-> (host java.lang.Class [a]) Bool)) + (All [a] (-> (primitive java.lang.Class [a]) Bool)) (_lux_proc ["jvm" "invokevirtual:java.lang.Class:isInterface:"] [class])) (def: (load-class class-name) - (-> Text (Either Text (host java.lang.Class [(Ex [a] a)]))) + (-> Text (Either Text (primitive java.lang.Class [(Ex [a] a)]))) (try (_lux_proc ["jvm" "invokestatic:java.lang.Class:forName:java.lang.String"] [class-name]))) (def: (class-kind [class-name _]) @@ -1932,7 +1932,7 @@ (def: (type->class-name type) (-> Type (Meta Text)) (case type - (#;Host name params) + (#;Primitive name params) (:: Monad wrap name) (#;Apply A F) diff --git a/stdlib/source/lux/meta/poly.lux b/stdlib/source/lux/meta/poly.lux index 04ac1fd82..c374e585c 100644 --- a/stdlib/source/lux/meta/poly.lux +++ b/stdlib/source/lux/meta/poly.lux @@ -128,15 +128,15 @@ [void "Void" #;Void] [unit "Unit" #;Unit] - [bool "Bool" (#;Host "#Bool" #;Nil)] - [nat "Nat" (#;Host "#Nat" #;Nil)] - [int "Int" (#;Host "#Int" #;Nil)] - [deg "Deg" (#;Host "#Deg" #;Nil)] - [frac "Frac" (#;Host "#Frac" #;Nil)] - [text "Text" (#;Host "#Text" #;Nil)] + [bool "Bool" (#;Primitive "#Bool" #;Nil)] + [nat "Nat" (#;Primitive "#Nat" #;Nil)] + [int "Int" (#;Primitive "#Int" #;Nil)] + [deg "Deg" (#;Primitive "#Deg" #;Nil)] + [frac "Frac" (#;Primitive "#Frac" #;Nil)] + [text "Text" (#;Primitive "#Text" #;Nil)] ) -(def: #export primitive +(def: #export basic (Poly Type) (do p;Monad [headT any] @@ -399,9 +399,9 @@ (def: #export (to-ast env type) (-> Env Type Code) (case type - (#;Host name params) - (` (#;Host (~ (code;text name)) - (list (~@ (list/map (to-ast env) params))))) + (#;Primitive name params) + (` (#;Primitive (~ (code;text name)) + (list (~@ (list/map (to-ast env) params))))) (^template [] diff --git a/stdlib/source/lux/meta/poly/eq.lux b/stdlib/source/lux/meta/poly/eq.lux index c2ecd5988..38386a6c8 100644 --- a/stdlib/source/lux/meta/poly/eq.lux +++ b/stdlib/source/lux/meta/poly/eq.lux @@ -38,7 +38,7 @@ (function [type] (` (eq;Eq (~ (poly;to-ast *env* type))))))]] ($_ p;either - ## Primitive types + ## Basic types (~~ (do-template [ ] [(do @ [_ ] diff --git a/stdlib/source/lux/meta/type.lux b/stdlib/source/lux/meta/type.lux index ad51b0c58..e7c630966 100644 --- a/stdlib/source/lux/meta/type.lux +++ b/stdlib/source/lux/meta/type.lux @@ -14,8 +14,8 @@ (def: (beta-reduce env type) (-> (List Type) Type Type) (case type - (#;Host name params) - (#;Host name (List/map (beta-reduce env) params)) + (#;Primitive name params) + (#;Primitive name (List/map (beta-reduce env) params)) (^template [] ( left right) @@ -46,7 +46,7 @@ (struct: #export _ (Eq Type) (def: (= x y) (case [x y] - [(#;Host xname xparams) (#;Host yname yparams)] + [(#;Primitive xname xparams) (#;Primitive yname yparams)] (and (Text/= xname yname) (n.= (list;size yparams) (list;size xparams)) (List/fold (;function [[x y] prev] (and prev (= x y))) @@ -167,9 +167,9 @@ (def: #export (to-ast type) (-> Type Code) (case type - (#;Host name params) - (` (#;Host (~ (code;text name)) - (list (~@ (List/map to-ast params))))) + (#;Primitive name params) + (` (#;Primitive (~ (code;text name)) + (list (~@ (List/map to-ast params))))) (^template [] @@ -206,13 +206,13 @@ (def: #export (to-text type) (-> Type Text) (case type - (#;Host name params) + (#;Primitive name params) (case params #;Nil - ($_ Text/compose "(host " name ")") + ($_ Text/compose "(primitive " name ")") _ - ($_ Text/compose "(host " name " " (|> params (List/map to-text) list;reverse (list;interpose " ") (List/fold Text/compose "")) ")")) + ($_ Text/compose "(primitive " name " " (|> params (List/map to-text) list;reverse (list;interpose " ") (List/fold Text/compose "")) ")")) #;Void "Void" @@ -351,4 +351,4 @@ (-> Nat Type Type) (case level +0 elem-type - _ (#;Host "#Array" (list (array (n.dec level) elem-type))))) + _ (#;Primitive "#Array" (list (array (n.dec level) elem-type))))) diff --git a/stdlib/source/lux/meta/type/check.lux b/stdlib/source/lux/meta/type/check.lux index 3b7c95cc4..296aee11a 100644 --- a/stdlib/source/lux/meta/type/check.lux +++ b/stdlib/source/lux/meta/type/check.lux @@ -241,10 +241,10 @@ (wrap type)))) (wrap type)))) - (#;Host name params) + (#;Primitive name params) (do Monad [=params (monad;map @ (clean t-id) params)] - (wrap (#;Host name =params))) + (wrap (#;Primitive name =params))) (^template [] ( left right) @@ -476,7 +476,7 @@ actual' (apply-type! actual ex)] (check' expected actual' assumptions)) - [(#;Host e-name e-params) (#;Host a-name a-params)] + [(#;Primitive e-name e-params) (#;Primitive a-name a-params)] (if (and (text/= e-name a-name) (n.= (list;size e-params) (list;size a-params))) diff --git a/stdlib/source/lux/meta/type/object.lux b/stdlib/source/lux/meta/type/object.lux index dd2552eab..43b563122 100644 --- a/stdlib/source/lux/meta/type/object.lux +++ b/stdlib/source/lux/meta/type/object.lux @@ -312,11 +312,11 @@ (def: (type-to-code type) (-> Type (Meta Code)) (case type - (#;Host name params) + (#;Primitive name params) (do Monad [paramsC+ (M;map @ type-to-code params)] - (wrap (` (;host (~ (code;symbol ["" name])) - (~@ paramsC+))))) + (wrap (` (;primitive (~ (code;symbol ["" name])) + (~@ paramsC+))))) #;Void (Meta/wrap (` (;|))) diff --git a/stdlib/source/lux/meta/type/opaque.lux b/stdlib/source/lux/meta/type/opaque.lux index 460ae22c4..acd73d6a4 100644 --- a/stdlib/source/lux/meta/type/opaque.lux +++ b/stdlib/source/lux/meta/type/opaque.lux @@ -156,7 +156,7 @@ representation-declaration (` ((~ hidden-name) (~@ type-varsC)))] (wrap (list& (` (type: (~@ (csw;export export)) (~ opaque-declaration) (~ (csw;annotations annotations)) - (host (~ hidden-name) [(~@ type-varsC)]))) + (primitive (~ hidden-name) [(~@ type-varsC)]))) (` (type: (~@ (csw;export export)) (~ representation-declaration) (~ representation-type))) (` (install-casts (~ (code;local-symbol name)) [(~@ type-varsC)])) diff --git a/stdlib/source/lux/meta/type/unit.lux b/stdlib/source/lux/meta/type/unit.lux index 9382a0506..de00fb82d 100644 --- a/stdlib/source/lux/meta/type/unit.lux +++ b/stdlib/source/lux/meta/type/unit.lux @@ -70,7 +70,7 @@ [annotations (p;default cs;empty-annotations csr;annotations)]) (wrap (list (` (type: (~@ (csw;export export)) (~ (code;local-symbol name)) (~ (csw;annotations annotations)) - (host (~ (code;local-symbol (unit-name name)))))) + (primitive (~ (code;local-symbol (unit-name name)))))) (` (def: (~@ (csw;export export)) (~ (code;local-symbol (format "@" name))) (~ (code;local-symbol name)) (:!! []))) @@ -94,7 +94,7 @@ (let [g!scale (code;local-symbol name)] (wrap (list (` (type: (~@ (csw;export export)) ((~ g!scale) (~' u)) (~ (csw;annotations annotations)) - (host (~ (code;local-symbol (scale-name name))) [(~' u)]))) + (primitive (~ (code;local-symbol (scale-name name))) [(~' u)]))) (` (struct: (~@ (csw;export export)) (~ (code;local-symbol (format "@" name))) (;;Scale (~ g!scale)) (def: (~' scale) diff --git a/stdlib/source/lux/world/blob.jvm.lux b/stdlib/source/lux/world/blob.jvm.lux index 88efc1859..c31feb8e5 100644 --- a/stdlib/source/lux/world/blob.jvm.lux +++ b/stdlib/source/lux/world/blob.jvm.lux @@ -23,7 +23,7 @@ (|> +1 (bit;shift-left +8) n.dec)) (def: byte-to-nat - (-> (host java.lang.Byte) Nat) + (-> (primitive java.lang.Byte) Nat) (|>. host;b2l (:! Nat) (bit;and byte-mask))) (def: #export (create size) diff --git a/stdlib/test/test/lux/meta/type/check.lux b/stdlib/test/test/lux/meta/type/check.lux index 253ce5939..5fb207cec 100644 --- a/stdlib/test/test/lux/meta/type/check.lux +++ b/stdlib/test/test/lux/meta/type/check.lux @@ -46,7 +46,7 @@ (def: (valid-type? type) (-> Type Bool) (case type - (#;Host name params) + (#;Primitive name params) (list;every? valid-type? params) (^or #;Void #;Unit (#;Ex id)) @@ -132,7 +132,7 @@ (@;checks? (type;tuple (list meta data)) (|> Ann (#;Apply meta) (#;Apply data)))))))) -(context: "Host types" +(context: "Primitive types" (<| (times +100) (do @ [nameL gen-name @@ -140,17 +140,17 @@ paramL gen-type paramR (|> gen-type (r;filter (|>. (@;checks? paramL) not)))] ($_ seq - (test "Host types match when they have the same name and the same parameters." - (@;checks? (#;Host nameL (list paramL)) - (#;Host nameL (list paramL)))) + (test "Primitive types match when they have the same name and the same parameters." + (@;checks? (#;Primitive nameL (list paramL)) + (#;Primitive nameL (list paramL)))) - (test "Names matter to host types." - (not (@;checks? (#;Host nameL (list paramL)) - (#;Host nameR (list paramL))))) + (test "Names matter to primitive types." + (not (@;checks? (#;Primitive nameL (list paramL)) + (#;Primitive nameR (list paramL))))) - (test "Parameters matter to host types." - (not (@;checks? (#;Host nameL (list paramL)) - (#;Host nameL (list paramR))))) + (test "Parameters matter to primitive types." + (not (@;checks? (#;Primitive nameL (list paramL)) + (#;Primitive nameL (list paramR))))) )))) (context: "Type-vars" -- cgit v1.2.3