diff options
author | Eduardo Julian | 2023-01-05 02:33:52 -0400 |
---|---|---|
committer | Eduardo Julian | 2023-01-05 02:33:52 -0400 |
commit | ab1829d77c7d12af344af68d6c50d391f1126640 (patch) | |
tree | eb7a228fbe22a7631272e14b5ac6743c64dafaee /lux-c++/source | |
parent | 3ca054b6b992e2233d763aabc5c938ee10d116a4 (diff) |
Compilation of simple literals in C++.
Diffstat (limited to '')
-rw-r--r-- | lux-c++/source/program.lux | 28 |
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 |