diff options
author | Eduardo Julian | 2021-06-08 19:00:32 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-06-08 19:00:32 -0400 |
commit | 920a1a35d4500391c9f69ac4ef4e90f53c7d4dfc (patch) | |
tree | a786489a6e7fc7440aad1d9dec2d0856fecdf9e0 /stdlib | |
parent | 512d7feeb915376c090aedaf64e8209689becd2a (diff) |
Properly using artifact IDs instead of arbitrary Text to identify artifacts.
Diffstat (limited to '')
11 files changed, 31 insertions, 30 deletions
diff --git a/stdlib/source/lux/tool/compiler/default/init.lux b/stdlib/source/lux/tool/compiler/default/init.lux index 993dd150d..781383df8 100644 --- a/stdlib/source/lux/tool/compiler/default/init.lux +++ b/stdlib/source/lux/tool/compiler/default/init.lux @@ -247,8 +247,8 @@ (wrap [state (#.Right [descriptor (document.write key analysis_module) - (row\map (function (_ [name directive]) - [name (write_directive directive)]) + (row\map (function (_ [artifact_id directive]) + [artifact_id (write_directive directive)]) final_buffer)])])) (#.Some [source requirements temporary_payload]) diff --git a/stdlib/source/lux/tool/compiler/default/platform.lux b/stdlib/source/lux/tool/compiler/default/platform.lux index 0ef931275..97ab64d3d 100644 --- a/stdlib/source/lux/tool/compiler/default/platform.lux +++ b/stdlib/source/lux/tool/compiler/default/platform.lux @@ -92,9 +92,9 @@ (-> Static <Platform> archive.ID [Descriptor (Document Any) Output] (Promise (Try Any)))) (let [system (get@ #&file_system platform) - write_artifact! (: (-> [Text Binary] (Action Any)) - (function (_ [name content]) - (ioW.write system static module_id name content)))] + write_artifact! (: (-> [artifact.ID Binary] (Action Any)) + (function (_ [artifact_id content]) + (ioW.write system static module_id artifact_id content)))] (do {! ..monad} [_ (ioW.prepare system static module_id) _ (for {@.python (|> output diff --git a/stdlib/source/lux/tool/compiler/language/lux/generation.lux b/stdlib/source/lux/tool/compiler/language/lux/generation.lux index dbc56bc0d..8606b5701 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/generation.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/generation.lux @@ -33,16 +33,16 @@ [archive.ID artifact.ID]) (type: #export (Buffer directive) - (Row [Text directive])) + (Row [artifact.ID directive])) (exception: #export (cannot_interpret {error Text}) (exception.report ["Error" error])) (template [<name>] - [(exception: #export (<name> {name Text}) + [(exception: #export (<name> {artifact_id artifact.ID}) (exception.report - ["Output" (%.text name)]))] + ["Artifact ID" (%.nat artifact_id)]))] [cannot_overwrite_output] [no_buffer_for_saving_code] @@ -220,20 +220,20 @@ (#try.Failure error) (exception.throw ..cannot_interpret error)))) -(def: #export (save! name code) +(def: #export (save! artifact_id code) (All [anchor expression directive] - (-> Text directive (Operation anchor expression directive Any))) + (-> artifact.ID directive (Operation anchor expression directive Any))) (do {! phase.monad} [?buffer (extension.read (get@ #buffer))] (case ?buffer (#.Some buffer) ## TODO: Optimize by no longer checking for overwrites... - (if (row.any? (|>> product.left (text\= name)) buffer) - (phase.throw ..cannot_overwrite_output [name]) - (extension.update (set@ #buffer (#.Some (row.add [name code] buffer))))) + (if (row.any? (|>> product.left (n.= artifact_id)) buffer) + (phase.throw ..cannot_overwrite_output [artifact_id]) + (extension.update (set@ #buffer (#.Some (row.add [artifact_id code] buffer))))) #.None - (phase.throw ..no_buffer_for_saving_code [name])))) + (phase.throw ..no_buffer_for_saving_code [artifact_id])))) (template [<name> <artifact>] [(def: #export (<name> name) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux index 265b0aef5..a33fbc5e1 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux @@ -114,7 +114,7 @@ id (/////generation.learn name) module_id (phase.lift (archive.id module archive)) [target_name value directive] (/////generation.define! [module_id id] codeG) - _ (/////generation.save! (%.nat id) directive)] + _ (/////generation.save! id directive)] (wrap [code//type codeG value])))) (def: (definition archive name expected codeC) @@ -166,7 +166,7 @@ module_id (phase.lift (archive.id current_module archive)) id (<learn> extension) [target_name value directive] (/////generation.define! [module_id id] codeG) - _ (/////generation.save! (%.nat id) directive)] + _ (/////generation.save! id directive)] (wrap [codeG value]))))) (def: #export (<full> archive extension codeT codeC) @@ -392,7 +392,7 @@ (do phase.monad [programG (generate archive programS) artifact_id (/////generation.learn /////program.name)] - (/////generation.save! (%.nat artifact_id) (program [module_id artifact_id] programG)))) + (/////generation.save! artifact_id (program [module_id artifact_id] programG)))) (def: (def::program program) (All [anchor expression directive] diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux index 3784c001c..ce4ab223c 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux @@ -93,7 +93,7 @@ (_.return elseG) conditionalsG))] _ (generation.execute! directive) - _ (generation.save! (%.nat context_artifact) directive)] + _ (generation.save! context_artifact directive)] (wrap (_.apply/* (list& inputG foreigns) @expression))))])) (def: lux_procs diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/php/case.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/php/case.lux index 137c72c71..728902418 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/php/case.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/php/case.lux @@ -293,5 +293,5 @@ pathP)) directive (_.define_function @case (list\map _.parameter @dependencies+) case!)] _ (/////generation.execute! directive) - _ (/////generation.save! (%.nat case_artifact) directive)] + _ (/////generation.save! case_artifact directive)] (wrap (_.apply/* @dependencies+ @case)))) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/php/function.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/php/function.lux index 8dad09d37..1194cfe9a 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/php/function.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/php/function.lux @@ -111,5 +111,5 @@ (_.return (_.call_user_func_array/2 [@selfL (_.array_merge/+ @curried (list @missing))]))))))) ))] _ (/////generation.execute! definition) - _ (/////generation.save! (%.nat (product.right function_name)) definition)] + _ (/////generation.save! (product.right function_name) definition)] (wrap instantiation))) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/php/loop.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/php/loop.lux index 41289ed58..b1fb94050 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/php/loop.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/php/loop.lux @@ -100,7 +100,7 @@ (_.return (_.closure (list\map _.parameter foreigns) (list) scope!))) (_.apply/* foreigns @loop)]))] _ (/////generation.execute! directive) - _ (/////generation.save! (%.nat loop_artifact) directive)] + _ (/////generation.save! loop_artifact directive)] (wrap (_.apply/* (list) instantiation))))) (def: @temp diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux index 304b79bdb..041993fb5 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux @@ -599,11 +599,11 @@ (Operation [Registry Output]) (do ///////phase.monad [_ (/////generation.execute! ..runtime) - _ (/////generation.save! (%.nat ..module_id) ..runtime)] + _ (/////generation.save! ..module_id ..runtime)] (wrap [(|> artifact.empty artifact.resource product.right) - (row.row [(%.nat ..module_id) + (row.row [..module_id (|> ..runtime _.code (\ utf8.codec encode))])]))) diff --git a/stdlib/source/lux/tool/compiler/meta/archive.lux b/stdlib/source/lux/tool/compiler/meta/archive.lux index d6d5e6d5d..09b501ef3 100644 --- a/stdlib/source/lux/tool/compiler/meta/archive.lux +++ b/stdlib/source/lux/tool/compiler/meta/archive.lux @@ -28,6 +28,7 @@ [type abstract]] [/ + ["." artifact] ["." signature (#+ Signature)] ["." key (#+ Key)] ["." descriptor (#+ Module Descriptor)] @@ -36,7 +37,7 @@ [version (#+ Version)]]]) (type: #export Output - (Row [Text Binary])) + (Row [artifact.ID Binary])) (exception: #export (unknown_document {module Module} {known_modules (List Module)}) diff --git a/stdlib/source/lux/tool/compiler/meta/io/archive.lux b/stdlib/source/lux/tool/compiler/meta/io/archive.lux index 3ff972838..8cf7fdcc2 100644 --- a/stdlib/source/lux/tool/compiler/meta/io/archive.lux +++ b/stdlib/source/lux/tool/compiler/meta/io/archive.lux @@ -83,11 +83,11 @@ (\ system separator) (%.nat module_id))) -(def: #export (artifact system static module_id name) - (All [!] (-> (file.System !) Static archive.ID Text Path)) +(def: #export (artifact system static module_id artifact_id) + (All [!] (-> (file.System !) Static archive.ID artifact.ID Path)) (format (..module system static module_id) (\ system separator) - name + (%.nat artifact_id) (get@ #static.artifact_extension static))) (def: #export (prepare system static module_id) @@ -110,12 +110,12 @@ module_id error]))))))) -(def: #export (write system static module_id name content) - (-> (file.System Promise) Static archive.ID Text Binary (Promise (Try Any))) +(def: #export (write system static module_id artifact_id content) + (-> (file.System Promise) Static archive.ID artifact.ID Binary (Promise (Try Any))) (do (try.with promise.monad) [artifact (: (Promise (Try (File Promise))) (file.get_file promise.monad system - (..artifact system static module_id name)))] + (..artifact system static module_id artifact_id)))] (!.use (\ artifact over_write) content))) (def: #export (enable system static) |