aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/ffi.js.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/library/lux/ffi.js.lux')
-rw-r--r--stdlib/source/library/lux/ffi.js.lux51
1 files changed, 15 insertions, 36 deletions
diff --git a/stdlib/source/library/lux/ffi.js.lux b/stdlib/source/library/lux/ffi.js.lux
index 247894177..6a130d4a1 100644
--- a/stdlib/source/library/lux/ffi.js.lux
+++ b/stdlib/source/library/lux/ffi.js.lux
@@ -23,11 +23,15 @@
["." template]]]])
(abstract: .public (Object brand)
+ {}
+
Any)
(template [<name>]
[(with_expansions [<brand> (template.identifier [<name> "'"])]
(abstract: <brand>
+ {}
+
Any
(type: .public <name>
@@ -153,7 +157,6 @@
input))
(def: .public (null _)
- {#.doc (example "The null pointer.")}
(-> Any Nothing)
(:expected ("js object null")))
@@ -238,18 +241,6 @@
(~+ (list\each (with_null g!temp) g!inputs)))))))))))
(syntax: .public (import: [import ..import])
- {#.doc (example "Easily import types, methods, functions and constants."
- (import: Uint8Array)
-
- (import: TextEncoder
- ["#::."
- (new [..String])
- (encode [..String] Uint8Array)])
-
- (import: TextDecoder
- ["#::."
- (new [..String])
- (decode [..String] String)]))}
(with_identifiers [g!temp g!_]
(case import
(#Class [[class_name class_parameters] format members])
@@ -337,17 +328,10 @@
)))
(template: .public (type_of object)
- {#.doc (example "The type of an object, as text."
- (and (= "boolean" (type_of #1))
- (= "number" (type_of +123.456))
- (= "string" (type_of "789"))
- (= "function" (type_of (function (_ value) value)))))}
- ("js type-of" object))
+ [("js type-of" object)])
(syntax: .public (constant [type <code>.any
[head tail] (<code>.tuple (<>.and <code>.local_identifier (<>.some <code>.local_identifier)))])
- {#.doc (example "Allows using definitions from the JavaScript host platform."
- (constant .Frac [Math PI]))}
(with_identifiers [g!_]
(let [constant (` ("js constant" (~ (code.text head))))]
(case tail
@@ -372,12 +356,12 @@
(~+ (list\each code.local_identifier tail))])))))))))))
(template: (!defined? <constant>)
- (.case (..constant Any <constant>)
- #.None
- .false
+ [(.case (..constant Any <constant>)
+ #.None
+ .false
- (#.Some _)
- .true))
+ (#.Some _)
+ .true)])
(template [<name> <constant>]
[(def: .public <name>
@@ -404,13 +388,8 @@
false))
(template: .public (closure <inputs> <output>)
- {#.doc (example "Allows defining closures/anonymous-functions in the form that JavaScript expects."
- "This is useful for adapting Lux functions for usage by JavaScript code."
- (: ..Function
- (closure [left right]
- (do_something (:as Foo left) (:as Bar right)))))}
- (.:as ..Function
- (`` ("js function"
- (~~ (template.amount <inputs>))
- (.function (_ [<inputs>])
- <output>)))))
+ [(.:as ..Function
+ (`` ("js function"
+ (~~ (template.amount <inputs>))
+ (.function (_ [<inputs>])
+ <output>))))])