From 2800492f26ee51c75fc056493e0946b39d5f503b Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 3 Oct 2022 02:22:11 -0400 Subject: Migrating default extensions to the new format [Part 0] --- stdlib/source/library/lux.lux | 47 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 9 deletions(-) (limited to 'stdlib/source/library/lux.lux') diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index 19cc619a2..e1092f696 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -524,6 +524,15 @@ {#Product Bit {#Product Type Any}}}) .public) +... (type .public Default +... Definition) +("lux def" Default + ("lux type check" + Type + {#Named [..prelude "Default"] + Definition}) + .public) + ... (type .public Alias ... Symbol) ("lux def" Alias @@ -536,13 +545,15 @@ ... (type .public Global ... (Variant ... {#Definition Definition} -... {#Alias Alias})) +... {#Alias Alias} +... {#Default Default})) ("lux def" Global ("lux type check" Type {#Named [..prelude "Global"] {#Sum Definition - Alias}}) + {#Sum Alias + Default}}}) .public) ("lux def" global_tags @@ -550,10 +561,12 @@ {#Apply Symbol List} {#Item [..prelude "#Definition"] {#Item [..prelude "#Alias"] - {#End}}}) + {#Item [..prelude "#Default"] + {#End}}}}) #0) ("lux def" #Definition (tag [{#Some [0 #0 ..global_tags]} Global]) .public) -("lux def" #Alias (tag [{#Some [0 #1 ..global_tags]} Global]) .public) +("lux def" #Alias (tag [{#Some [1 #0 ..global_tags]} Global]) .public) +("lux def" #Default (tag [{#Some [1 #1 ..global_tags]} Global]) .public) ... (type .public (Bindings k v) ... (Record @@ -1907,7 +1920,10 @@ {#Right [state full_name]} {#Alias real_name} - {#Right [state real_name]}} + {#Right [state real_name]} + + {#Default _} + {#Left (all text#composite "Unknown definition: " (symbol#encoded full_name))}} constant) {#None} @@ -2037,7 +2053,10 @@ {#Definition [exported? def_type def_value]} (if (available? expected_module current_module exported?) {#Right [state [def_type def_value]]} - {#Left (text#composite "Unavailable definition: " (symbol#encoded name))})} + {#Left (text#composite "Unavailable definition: " (symbol#encoded name))}) + + {#Default _} + {#Left (text#composite "Unknown definition: " (symbol#encoded name))}} definition)} (property#value expected_short definitions))} (property#value expected_module modules)))) @@ -2713,7 +2732,10 @@ (if (text#= module current_module) {#Some ("lux type as" Macro def_value)} {#None})) - {#None})} + {#None}) + + {#Default _} + {#None}} ("lux type check" Global gdef)))) (def' .private (named_macro full_name) @@ -4545,7 +4567,10 @@ {#Definition [exported? def_type def_value]} (if exported? (list name) - (list))))) + (list)) + + {#Default _} + (list)))) (let [[..#module_hash _ ..#module_aliases _ ..#definitions definitions ..#imports _ ..#module_state _] =module] definitions))] {#Right state (list#conjoint to_alias)}) @@ -4677,7 +4702,10 @@ (definition_type real_name state) {#Definition [exported? def_type def_value]} - {#Some def_type}))))) + {#Some def_type} + + {#Default _} + {#None}))))) (def (type_variable idx bindings) (-> Nat (List [Nat (Maybe Type)]) (Maybe Type)) @@ -5880,6 +5908,7 @@ (with_template [] [(def .public + Type (let [[_ short] (symbol )] {.#Primitive (text#composite "#" short) (list)}))] -- cgit v1.2.3