aboutsummaryrefslogtreecommitdiff
path: root/lux-c++
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lux-c++/source/program.lux28
1 files changed, 18 insertions, 10 deletions
diff --git a/lux-c++/source/program.lux b/lux-c++/source/program.lux
index 6bfa65d4f..cb2b96029 100644
--- a/lux-c++/source/program.lux
+++ b/lux-c++/source/program.lux
@@ -11,10 +11,7 @@
["[0]" maybe (.use "[1]#[0]" monad)]
["[0]" try (.only Try)]
["[0]" exception (.only Exception)]
- ["[0]" io (.only IO io)]
- ["[0]" function]
- [concurrency
- ["[0]" async (.only Async)]]]
+ ["[0]" io (.only IO io)]]
[data
["[0]" product]
[text
@@ -32,8 +29,8 @@
["[0]" file]
["[1]/[0]" environment]]
[meta
- ["@" target (.only)
- ["_" js]]
+ [target
+ ["_" c++]]
[macro
["^" pattern]
["[0]" template]]
@@ -54,9 +51,8 @@
["[1]" js]]]
[translation
["[0]" reference]
- ["[0]" js (.only)
- ["[0]" runtime]
- ["[1]/[0]" reference]]]]]]
+ [c++
+ ["[0]" primitive]]]]]]
[default
["[0]" platform (.only Platform)]]
[meta
@@ -74,10 +70,22 @@
("static" cppdef [Text] "io" Bit)
("static" gbl (ffi.Object Any)))
+(def (print it)
+ (-> _.Expression
+ Text)
+ (%.format "std::cout << "
+ (_.code it)
+ " << std::endl;"))
+
(def _
(program []
(do io.monad
- [? (cppyy::cppdef ["void say_hello() { std::cout << 123 << std::endl; }"])
+ [? (cppyy::cppdef [(%.format "void say_hello() { "
+ (print (primitive.bit true))
+ (print (primitive.i64 +123))
+ (print (primitive.f64 -456.789))
+ (print (primitive.text "YOLO"))
+ " }")])
.let [_ (debug.log! (%.format "BEFORE " (%.bit ?)))]
global (cppyy::gbl)
.let [say_hello (as ffi.Function