From 442d1557b879a8a4bd76f441f72a17bfb71cf05f Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 17 Jul 2021 22:48:54 -0400 Subject: Now allowing compilers to generate custom-named outputs. --- lux-jvm/source/luxc/lang/translation/jvm.lux | 32 ++++++++++++++++++---------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'lux-jvm/source/luxc/lang/translation/jvm.lux') diff --git a/lux-jvm/source/luxc/lang/translation/jvm.lux b/lux-jvm/source/luxc/lang/translation/jvm.lux index 4cd521f9f..0f6ba6744 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm.lux @@ -14,6 +14,7 @@ [data [binary (#+ Binary)] ["." product] + ["." maybe] ["." text ("#@." hash) ["%" format (#+ format)]] [collection @@ -145,11 +146,13 @@ (loader.store class_name class_bytecode library))] (loader.load class_name loader)))) -(def: (define! library loader context valueI) - (-> Library java/lang/ClassLoader generation.Context Inst (Try [Text Any Definition])) +(def: (define! library loader context custom valueI) + (-> Library java/lang/ClassLoader generation.Context (Maybe Text) Inst (Try [Text Any Definition])) (do try.monad [[value definition] (evaluate! library loader context valueI)] - (wrap [(..class_name context) value definition]))) + (wrap [(maybe.default (..class_name context) + custom) + value definition]))) (def: #export host (IO Host) @@ -170,19 +173,26 @@ (def: (ingest context bytecode) [(..class_name context) bytecode]) - (def: (re_learn context [_ bytecode]) + (def: (re_learn context custom [_ bytecode]) (io.run - (loader.store (..class_name context) bytecode library))) + (loader.store (maybe.default (..class_name context) custom) bytecode library))) - (def: (re_load context [_ bytecode]) + (def: (re_load context custom [_ bytecode]) (io.run (do (try.with io.monad) - [#let [class_name (..class_name context)] + [#let [class_name (maybe.default (..class_name context) custom)] _ (loader.store class_name bytecode library) class (loader.load class_name loader)] (\ io.monad wrap (..class_value class_name class)))))))))) -(def: #export $Variant (type.array ..$Value)) -(def: #export $Tuple (type.array ..$Value)) -(def: #export $Runtime (type.class (..class_name [0 0]) (list))) -(def: #export $Function (type.class (..class_name [0 1]) (list))) +(def: #export $Variant + (type.array ..$Value)) + +(def: #export $Tuple + (type.array ..$Value)) + +(def: #export $Runtime + (type.class (..class_name [0 0]) (list))) + +(def: #export $Function + (type.class (..class_name [0 1]) (list))) -- cgit v1.2.3