aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/host.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/host.lux98
1 files changed, 49 insertions, 49 deletions
diff --git a/stdlib/source/lux/host.lux b/stdlib/source/lux/host.lux
index 92ff61d92..22bd0f292 100644
--- a/stdlib/source/lux/host.lux
+++ b/stdlib/source/lux/host.lux
@@ -296,11 +296,11 @@
AST)
(case [name+params mode in-array?]
(^=> [[prim #;Nil] #ManualPrM false]
- {(manual-primitive-to-type prim) (#;Some output)})
+ [(manual-primitive-to-type prim) (#;Some output)])
output
(^=> [[prim #;Nil] #AutoPrM false]
- {(auto-primitive-to-type prim) (#;Some output)})
+ [(auto-primitive-to-type prim) (#;Some output)])
output
[[name params] _ _]
@@ -869,8 +869,8 @@
(def: (arg-decl^ imports type-vars)
(-> ClassImports (List TypeParam) (Syntax ArgDecl))
- (s;record (s;seq s;local-symbol
- (generic-type^ imports type-vars))))
+ (s;tuple (s;seq s;local-symbol
+ (generic-type^ imports type-vars))))
(def: (arg-decls^ imports type-vars)
(-> ClassImports (List TypeParam) (Syntax (List ArgDecl)))
@@ -1320,20 +1320,20 @@
{#super-class-name "java.lang.Object"
#super-class-params (list)})
-(syntax: #export (class: {#let [imports (class-imports *compiler*)]}
- {im inheritance-modifier^}
- {class-decl (class-decl^ imports)}
- {#let [full-class-name (product;left class-decl)
+(syntax: #export (class: [#let [imports (class-imports *compiler*)]]
+ [im inheritance-modifier^]
+ [class-decl (class-decl^ imports)]
+ [#let [full-class-name (product;left class-decl)
imports (add-import [(short-class-name full-class-name) full-class-name]
- (class-imports *compiler*))]}
- {#let [class-vars (product;right class-decl)]}
- {super (s;default object-super-class
- (super-class-decl^ imports class-vars))}
- {interfaces (s;default (list)
- (s;tuple (s;some (super-class-decl^ imports class-vars))))}
- {annotations (annotations^ imports)}
- {fields (s;some (field-decl^ imports class-vars))}
- {methods (s;some (method-def^ imports class-vars))})
+ (class-imports *compiler*))]]
+ [#let [class-vars (product;right class-decl)]]
+ [super (s;default object-super-class
+ (super-class-decl^ imports class-vars))]
+ [interfaces (s;default (list)
+ (s;tuple (s;some (super-class-decl^ imports class-vars))))]
+ [annotations (annotations^ imports)]
+ [fields (s;some (field-decl^ imports class-vars))]
+ [methods (s;some (method-def^ imports class-vars))])
{#;doc (doc "Allows defining JVM classes in Lux code."
"For example:"
(class: #final (JvmPromise A) []
@@ -1405,16 +1405,16 @@
(with-brackets (spaced (map (method-def$ replacer super) methods))))))]]
(wrap (list (` (;_lux_proc ["jvm" (~ (ast;text def-code))] []))))))
-(syntax: #export (interface: {#let [imports (class-imports *compiler*)]}
- {class-decl (class-decl^ imports)}
- {#let [full-class-name (product;left class-decl)
+(syntax: #export (interface: [#let [imports (class-imports *compiler*)]]
+ [class-decl (class-decl^ imports)]
+ [#let [full-class-name (product;left class-decl)
imports (add-import [(short-class-name full-class-name) full-class-name]
- (class-imports *compiler*))]}
- {#let [class-vars (product;right class-decl)]}
- {supers (s;default (list)
- (s;tuple (s;some (super-class-decl^ imports class-vars))))}
- {annotations (annotations^ imports)}
- {members (s;some (method-decl^ imports class-vars))})
+ (class-imports *compiler*))]]
+ [#let [class-vars (product;right class-decl)]]
+ [supers (s;default (list)
+ (s;tuple (s;some (super-class-decl^ imports class-vars))))]
+ [annotations (annotations^ imports)]
+ [members (s;some (method-decl^ imports class-vars))])
(let [def-code (format "interface:"
(spaced (list (class-decl$ class-decl)
(with-brackets (spaced (map super-class-decl$ supers)))
@@ -1423,14 +1423,14 @@
(wrap (list (` (;_lux_proc ["jvm" (~ (ast;text def-code))] []))))
))
-(syntax: #export (object {#let [imports (class-imports *compiler*)]}
- {#let [class-vars (list)]}
- {super (s;default object-super-class
- (super-class-decl^ imports class-vars))}
- {interfaces (s;default (list)
- (s;tuple (s;some (super-class-decl^ imports class-vars))))}
- {constructor-args (constructor-args^ imports class-vars)}
- {methods (s;some (overriden-method-def^ imports))})
+(syntax: #export (object [#let [imports (class-imports *compiler*)]]
+ [#let [class-vars (list)]]
+ [super (s;default object-super-class
+ (super-class-decl^ imports class-vars))]
+ [interfaces (s;default (list)
+ (s;tuple (s;some (super-class-decl^ imports class-vars))))]
+ [constructor-args (constructor-args^ imports class-vars)]
+ [methods (s;some (overriden-method-def^ imports))])
{#;doc (doc "Allows defining anonymous classes."
"The 1st vector corresponds to parent interfaces."
"The 2nd vector corresponds to arguments to the super class constructor."
@@ -1505,9 +1505,9 @@
[(#;Right (~ expr))
;;throwable->text])))))
-(syntax: #export (instance? {#let [imports (class-imports *compiler*)]}
- {class (generic-type^ imports (list))}
- {obj (s;opt s;any)})
+(syntax: #export (instance? [#let [imports (class-imports *compiler*)]]
+ [class (generic-type^ imports (list))]
+ [obj (s;opt s;any)])
{#;doc (doc "Checks whether an object is an instance of a particular class."
"Caveat emptor: Can't check for polymorphism, so avoid using parameterized classes."
(instance? String "YOLO"))}
@@ -1531,7 +1531,7 @@
(finish-the-computation ...))))}
(wrap (list (` (;_lux_proc ["jvm" "synchronized"] [(~ lock) (~ body)])))))
-(syntax: #export (do-to obj {methods (s;some partial-call^)})
+(syntax: #export (do-to obj [methods (s;some partial-call^)])
{#;doc (doc "Call a variety of methods on an object; then return the object."
(do-to vreq
(HttpServerRequest.setExpectMultipart [true])
@@ -1942,13 +1942,13 @@
(#;Left _)
(compiler;fail (format "Unknown class: " class-name))))
-(syntax: #export (jvm-import {#let [imports (class-imports *compiler*)]}
- {long-name? (s;tag? ["" "long"])}
- {class-decl (class-decl^ imports)}
- {#let [full-class-name (product;left class-decl)
+(syntax: #export (jvm-import [#let [imports (class-imports *compiler*)]]
+ [long-name? (s;tag? ["" "long"])]
+ [class-decl (class-decl^ imports)]
+ [#let [full-class-name (product;left class-decl)
imports (add-import [(short-class-name full-class-name) full-class-name]
- (class-imports *compiler*))]}
- {members (s;some (import-member-decl^ imports (product;right class-decl)))})
+ (class-imports *compiler*))]]
+ [members (s;some (import-member-decl^ imports (product;right class-decl)))])
{#;doc (doc "Allows importing JVM classes, and using them as types."
"Their methods, fields and enum options can also be imported."
"Also, classes which get imported into a module can also be referred-to with their short names in other macros that require JVM classes."
@@ -2000,8 +2000,8 @@
=members (mapM @ (member-import$ (product;right class-decl) long-name? kind class-decl) members)]
(wrap (list& (class-import$ long-name? class-decl) (List/join =members)))))
-(syntax: #export (array {#let [imports (class-imports *compiler*)]}
- {type (generic-type^ imports (list))}
+(syntax: #export (array [#let [imports (class-imports *compiler*)]]
+ [type (generic-type^ imports (list))]
size)
{#;doc (doc "Create an array of the given type, with the given size."
(array Object +10))}
@@ -2112,7 +2112,7 @@
(Syntax (List [Text AST]))
(s;tuple (s;some (s;seq s;local-symbol s;any))))
-(syntax: #export (with-open {bindings simple-bindings^} body)
+(syntax: #export (with-open [bindings simple-bindings^] body)
{#;doc (doc "Creates a local-binding with the desired resources, and runs the body (assumed to be in the IO type)."
"Afterwards, closes all resources (assumed to be subclasses of java.io.Closeable), and returns the value resulting from running the body."
(with-open [my-res1 (res1-constructor ...)
@@ -2135,8 +2135,8 @@
(~' #let) [(~ g!_) (exec (~@ (reverse closes)) [])]]
((~' wrap) (~ g!output)))))))))
-(syntax: #export (class-for {#let [imports (class-imports *compiler*)]}
- {type (generic-type^ imports (list))})
+(syntax: #export (class-for [#let [imports (class-imports *compiler*)]]
+ [type (generic-type^ imports (list))])
{#;doc (doc "Loads the class a a Class object."
(class-for java.lang.String))}
(wrap (list (` (;_lux_proc ["jvm" "load-class"] [(~ (ast;text (simple-class$ (list) type)))])))))