aboutsummaryrefslogtreecommitdiff
path: root/lux-jvm/source/luxc/lang/translation/jvm.lux
diff options
context:
space:
mode:
Diffstat (limited to 'lux-jvm/source/luxc/lang/translation/jvm.lux')
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm.lux32
1 files changed, 21 insertions, 11 deletions
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)))