diff options
92 files changed, 1045 insertions, 867 deletions
diff --git a/documentation/bookmark/application_binary_interface.md b/documentation/bookmark/abi__application_binary_interface.md index 0cde5cb58..6b49b61f6 100644 --- a/documentation/bookmark/application_binary_interface.md +++ b/documentation/bookmark/abi__application_binary_interface.md @@ -1,5 +1,7 @@ # Reference +0. []() +0. [How Swift Achieved Dynamic Linking Where Rust Couldn't](https://gankra.github.io/blah/swift-abi/) 0. [Interface method calls with the Go register ABI](https://eli.thegreenplace.net/2022/interface-method-calls-with-the-go-register-abi/) 0. [To Save C, We Must Save ABI](https://thephd.dev/to-save-c-we-must-save-abi-fixing-c-function-abi) 0. [Making Libraries Consumable for Non-C++ Developers - Aaron R Robinson - CppCon 2021](https://www.youtube.com/watch?v=4r09pv9v1w0) diff --git a/documentation/bookmark/artificial_intelligence/differentiable_programming.md b/documentation/bookmark/artificial_intelligence/differentiable_programming.md index 69adc6a2f..96ba976cf 100644 --- a/documentation/bookmark/artificial_intelligence/differentiable_programming.md +++ b/documentation/bookmark/artificial_intelligence/differentiable_programming.md @@ -1,9 +1,12 @@ # Programming language +0. []() 0. [Myia](https://github.com/mila-iqia/myia) # Reference +0. []() +0. [The simple essence of automatic differentiation](http://conal.net/papers/essence-of-ad/) 0. [Provably Correct, Asymptotically Efficient, Higher-Order Reverse-Mode Automatic Differentiation](https://www.cl.cam.ac.uk/~nk480/higher-order-ad.pdf) 0. [Differentiable Programming in C++ - Vassil Vassilev & William Moses - CppCon 2021](https://www.youtube.com/watch?v=1QQj1mAV-eY) 0. [Demystifying Differentiable Programming: Shift/Reset the Penultimate Backpropagator](https://arxiv.org/abs/1803.10228) diff --git a/documentation/bookmark/back_end/JavaScript.md b/documentation/bookmark/back_end/JavaScript.md deleted file mode 100644 index f3c57b57f..000000000 --- a/documentation/bookmark/back_end/JavaScript.md +++ /dev/null @@ -1,9 +0,0 @@ -# Debugging - -1. [The JavaScript Self-Profiling API](https://addyosmani.com/blog/js-self-profiling/) - -# Number - -1. [BigInt: arbitrary-precision integers in JavaScript](https://v8.dev/features/bigint) -1. [WebAssembly integration with JavaScript BigInt](https://v8.dev/features/wasm-bigint) - diff --git a/documentation/bookmark/back_end/c++.md b/documentation/bookmark/back_end/c++.md deleted file mode 100644 index b1ee86bb3..000000000 --- a/documentation/bookmark/back_end/c++.md +++ /dev/null @@ -1,67 +0,0 @@ -# Optimization - -0. [C and C++ coding style for best performance](https://www.ibm.com/docs/en/aix/7.1?topic=implementation-c-c-coding-style-best-performance) - -# Reference - -0. [Constant references are not always your friends](https://belaycpp.com/2022/02/15/constant-references-are-not-always-your-friends/) -0. [Unionizing for Profit: How to Exploit the Power of Unions in C++](https://dev-discuss.pytorch.org/t/unionizing-for-profit-how-to-exploit-the-power-of-unions-in-c/444) -0. [std::any: How, when, and why](https://devblogs.microsoft.com/cppblog/stdany-how-when-and-why/) -0. [Using C Libraries in your Modern C++ Embedded Project - Michael Caisse - CppCon 2021](https://www.youtube.com/watch?v=Ototzy-nP4M) -0. [In-memory and Persistent Representations of C++ - Gabriel Dos Reis - CppCon 2021](https://www.youtube.com/watch?v=39wlNRk-nAg) -0. [Back to Basics: const and constexpr - Rainer Grimm - CppCon 2021](https://www.youtube.com/watch?v=tA6LbPyYdco) -0. [Misra Parallelism Safety-critical Guidelines for C++11, 17, Then C++20, 23 - CppCon 2021](https://www.youtube.com/watch?v=hVv7Nc3f4Jo) -0. [Back to Basics: Move Semantics - Nicolai Josuttis - CppCon 2021](https://www.youtube.com/watch?v=Bt3zcJZIalk) -0. [Type-and-resource Safety in Modern C++ - Bjarne Stroustrup - CppCon 2021](https://www.youtube.com/watch?v=l3rvjWfBzZI) -0. [Exceptional C++ - Victor Ciura - CppCon 2021](https://www.youtube.com/watch?v=SjlfhyZn2yA) - -# Undefined behavior - -0. [INT32-C. Ensure that operations on signed integers do not result in overflow](https://wiki.sei.cmu.edu/confluence/display/c/INT32-C.+Ensure+that+operations+on+signed+integers+do+not+result+in+overflow) -0. [Integer overflow](https://en.wikipedia.org/wiki/Integer_overflow#Handling) -0. [Back To Basics: Undefined Behavior - Ansel Sermersheim & Barbara Geller - CppCon 2021](https://www.youtube.com/watch?v=NpL9YnxnOqM) - -# Dependency management - -0. [vcpkg](https://vcpkg.io/en/index.html) - -# constexpr - -0. [Your New Mental Model of constexpr - Jason Turner - CppCon 2021](https://www.youtube.com/watch?v=MdrfPSUtMVM) - -# String - -0. [CsString (intro to unicode)](https://www.youtube.com/watch?v=nYzi0-VAXQM) -0. [CsString (library design)](https://www.youtube.com/watch?v=w_kD-qAkoH0) -0. [char8_t](https://www.youtube.com/watch?v=vOOLXvu-xtU) -0. [std::u32string](https://www.cplusplus.com/reference/string/u32string/) - -# Variadic functions - -0. [Variadic functions](https://en.cppreference.com/w/cpp/utility/variadic) -0. [Parameter pack](https://en.cppreference.com/w/cpp/language/parameter_pack) -0. [va_start](https://www.cplusplus.com/reference/cstdarg/va_start/) - -# Multi-threading - -0. [std::thread](https://en.cppreference.com/w/cpp/thread/thread) -0. [std::thread::hardware_concurrency](https://en.cppreference.com/w/cpp/thread/thread/hardware_concurrency) -0. [std::atomic](https://en.cppreference.com/w/cpp/atomic/atomic) -0. [std::atomic::compare_exchange_strong](https://www.cplusplus.com/reference/atomic/atomic/compare_exchange_strong/) - -# Interpreter - -0. [Clasp — Bringing Common Lisp and C++ Together](https://github.com/clasp-developers/clasp) -0. [Cling](https://root.cern/cling/) -0. [Interactive C++ with Cling](https://blog.llvm.org/posts/2020-11-30-interactive-cpp-with-cling/) -0. [Cling Transitions to LLVM's Clang-Repl](https://root.cern/blog/cling-in-llvm/) -0. [cppyy: Automatic Python-C++ bindings](https://cppyy.readthedocs.io/en/latest/index.html) - -# Cross-compilation - -0. [Cross compiling Windows binaries from Linux](https://jake-shadle.github.io/xwin/) -0. [Clang C++ Cross Compiler - Generating Windows Executable from Mac OS X](https://stackoverflow.com/questions/23248989/clang-c-cross-compiler-generating-windows-executable-from-mac-os-x) -0. [The Clang Universal Driver Project](https://clang.llvm.org/UniversalDriver.html) -0. [Cross-compilation using Clang](https://clang.llvm.org/docs/CrossCompilation.html) -0. [Wclang: Cross compile source code easily for Windows with clang on Linux/Unix](https://github.com/tpoechtrager/wclang) - diff --git a/documentation/bookmark/business/leadership.md b/documentation/bookmark/business/leadership.md index 1d453f73d..f2d633bc6 100644 --- a/documentation/bookmark/business/leadership.md +++ b/documentation/bookmark/business/leadership.md @@ -1,5 +1,7 @@ # Reference +0. []() +0. [Why You Should Create a “Shadow Board” of Younger Employees](https://hbr.org/2019/06/why-you-should-create-a-shadow-board-of-younger-employees) 0. [There’s No Such Thing as Constructive Criticism](https://hbr.org/2011/11/theres-no-such-thing-as-constr.html) 0. [How Patience Pays Off](https://www.permanentequity.com/writings/how-patience-pays-off) 0. [Why Agile Turns into Micromanagement](https://age-of-product.com/agile-micromanagement/) diff --git a/documentation/bookmark/business/management.md b/documentation/bookmark/business/management.md index f6ce4e385..fe1b947d6 100644 --- a/documentation/bookmark/business/management.md +++ b/documentation/bookmark/business/management.md @@ -1,6 +1,7 @@ # Reference 0. []() +0. [Scrum Teams are often Coached to Death, while the Problems are With Management](https://medium.com/serious-scrum/scrum-teams-are-often-coached-to-death-while-the-problems-are-with-management-60ac93bb0c1c) 0. [Monitoring Employees Makes Them More Likely to Break Rules](https://hbr.org/2022/06/monitoring-employees-makes-them-more-likely-to-break-rules) 0. [Why criticism lasts longer than praise](https://www.bbc.com/future/article/20220624-why-criticism-lasts-longer-than-praise) 0. [What Engineering Managers Should Do (and Why We Don’t) • Lena Reinhard • GOTO 2019](https://www.youtube.com/watch?v=Q_bJVokYLRI) diff --git a/documentation/bookmark/cloud.md b/documentation/bookmark/cloud.md new file mode 100644 index 000000000..3405f0166 --- /dev/null +++ b/documentation/bookmark/cloud.md @@ -0,0 +1,5 @@ +# Reference + +0. []() +0. [LocalStack: A fully functional local cloud stack](https://localstack.cloud/) + diff --git a/documentation/bookmark/compilation/target/c++.md b/documentation/bookmark/compilation/target/c++.md index d62ed0141..40625b60e 100644 --- a/documentation/bookmark/compilation/target/c++.md +++ b/documentation/bookmark/compilation/target/c++.md @@ -1,5 +1,98 @@ +# Memory management + +0. []() +0. [Memory and Performance Overhead of Smart Pointers](https://www.modernescpp.com/index.php/memory-and-performance-overhead-of-smart-pointer) +0. [](https://coderedirect.com/questions/464444/c-atomic-cascompare-and-swap-operation-does-not-change-value) +0. [C++ Shared_Ptr implementation](https://codereview.stackexchange.com/questions/254279/c-shared-ptr-implementation) +0. [C++: shared_ptr and how to write your own](https://medium.com/analytics-vidhya/c-shared-ptr-and-how-to-write-your-own-d0d385c118ad) +0. [How to implement user defined Shared Pointers in C++](https://www.geeksforgeeks.org/how-to-implement-user-defined-shared-pointers-in-c/) +0. [](https://en.cppreference.com/w/cpp/memory/shared_ptr) +0. [smart pointers](https://en.cppreference.com/book/intro/smart_pointers) +0. [](https://en.cppreference.com/w/cpp/numeric/bit_cast) +0. [reinterpret_cast conversion](https://en.cppreference.com/w/cpp/language/reinterpret_cast) +0. [Alternatives to std::atomic_ref](https://stackoverflow.com/questions/67620813/alternatives-to-stdatomic-ref) +0. [std::atomic_ref is awesome](https://www.reddit.com/r/cpp/comments/i8ckxr/stdatomic_ref_is_awesome/) +0. [](https://en.cppreference.com/w/cpp/atomic/atomic_ref) + +# Optimization + +0. []() +0. [Copy Elision](https://www.youtube.com/watch?v=_zZWUZEwXk8) +0. [C and C++ coding style for best performance](https://www.ibm.com/docs/en/aix/7.1?topic=implementation-c-c-coding-style-best-performance) + # Reference 0. []() +0. [C++ keywords: noexcept (since C++11)](https://en.cppreference.com/w/cpp/keyword/noexcept) +0. [alignas specifier (since C++11)](https://en.cppreference.com/w/cpp/language/alignas) +0. [Perfect Forwarding](https://www.modernescpp.com/index.php/perfect-forwarding) 0. [C++ Tips of the Week](https://abseil.io/tips/) +0. [Constant references are not always your friends](https://belaycpp.com/2022/02/15/constant-references-are-not-always-your-friends/) +0. [Unionizing for Profit: How to Exploit the Power of Unions in C++](https://dev-discuss.pytorch.org/t/unionizing-for-profit-how-to-exploit-the-power-of-unions-in-c/444) +0. [std::any: How, when, and why](https://devblogs.microsoft.com/cppblog/stdany-how-when-and-why/) +0. [Using C Libraries in your Modern C++ Embedded Project - Michael Caisse - CppCon 2021](https://www.youtube.com/watch?v=Ototzy-nP4M) +0. [In-memory and Persistent Representations of C++ - Gabriel Dos Reis - CppCon 2021](https://www.youtube.com/watch?v=39wlNRk-nAg) +0. [Back to Basics: const and constexpr - Rainer Grimm - CppCon 2021](https://www.youtube.com/watch?v=tA6LbPyYdco) +0. [Misra Parallelism Safety-critical Guidelines for C++11, 17, Then C++20, 23 - CppCon 2021](https://www.youtube.com/watch?v=hVv7Nc3f4Jo) +0. [Back to Basics: Move Semantics - Nicolai Josuttis - CppCon 2021](https://www.youtube.com/watch?v=Bt3zcJZIalk) +0. [Type-and-resource Safety in Modern C++ - Bjarne Stroustrup - CppCon 2021](https://www.youtube.com/watch?v=l3rvjWfBzZI) +0. [Exceptional C++ - Victor Ciura - CppCon 2021](https://www.youtube.com/watch?v=SjlfhyZn2yA) + +# Undefined behavior + +0. []() +0. [INT32-C. Ensure that operations on signed integers do not result in overflow](https://wiki.sei.cmu.edu/confluence/display/c/INT32-C.+Ensure+that+operations+on+signed+integers+do+not+result+in+overflow) +0. [Integer overflow](https://en.wikipedia.org/wiki/Integer_overflow#Handling) +0. [Back To Basics: Undefined Behavior - Ansel Sermersheim & Barbara Geller - CppCon 2021](https://www.youtube.com/watch?v=NpL9YnxnOqM) + +# Dependency management + +0. []() +0. [vcpkg](https://vcpkg.io/en/index.html) + +# constexpr + +0. []() +0. [Your New Mental Model of constexpr - Jason Turner - CppCon 2021](https://www.youtube.com/watch?v=MdrfPSUtMVM) + +# String + +0. []() +0. [CsString (intro to unicode)](https://www.youtube.com/watch?v=nYzi0-VAXQM) +0. [CsString (library design)](https://www.youtube.com/watch?v=w_kD-qAkoH0) +0. [char8_t](https://www.youtube.com/watch?v=vOOLXvu-xtU) +0. [std::u32string](https://www.cplusplus.com/reference/string/u32string/) + +# Variadic functions + +0. []() +0. [Variadic functions](https://en.cppreference.com/w/cpp/utility/variadic) +0. [Parameter pack](https://en.cppreference.com/w/cpp/language/parameter_pack) +0. [va_start](https://www.cplusplus.com/reference/cstdarg/va_start/) + +# Multi-threading + +0. []() +0. [std::thread](https://en.cppreference.com/w/cpp/thread/thread) +0. [std::thread::hardware_concurrency](https://en.cppreference.com/w/cpp/thread/thread/hardware_concurrency) +0. [std::atomic](https://en.cppreference.com/w/cpp/atomic/atomic) +0. [std::atomic::compare_exchange_strong](https://www.cplusplus.com/reference/atomic/atomic/compare_exchange_strong/) + +# Interpreter + +0. []() +0. [Clasp — Bringing Common Lisp and C++ Together](https://github.com/clasp-developers/clasp) +0. [Cling](https://root.cern/cling/) +0. [Interactive C++ with Cling](https://blog.llvm.org/posts/2020-11-30-interactive-cpp-with-cling/) +0. [Cling Transitions to LLVM's Clang-Repl](https://root.cern/blog/cling-in-llvm/) +0. [cppyy: Automatic Python-C++ bindings](https://cppyy.readthedocs.io/en/latest/index.html) + +# Cross-compilation + +0. []() +0. [Cross compiling Windows binaries from Linux](https://jake-shadle.github.io/xwin/) +0. [Clang C++ Cross Compiler - Generating Windows Executable from Mac OS X](https://stackoverflow.com/questions/23248989/clang-c-cross-compiler-generating-windows-executable-from-mac-os-x) +0. [The Clang Universal Driver Project](https://clang.llvm.org/UniversalDriver.html) +0. [Cross-compilation using Clang](https://clang.llvm.org/docs/CrossCompilation.html) +0. [Wclang: Cross compile source code easily for Windows with clang on Linux/Unix](https://github.com/tpoechtrager/wclang) diff --git a/documentation/bookmark/back_end/c.md b/documentation/bookmark/compilation/target/c.md index 73383e848..81fc2960d 100644 --- a/documentation/bookmark/back_end/c.md +++ b/documentation/bookmark/compilation/target/c.md @@ -1,5 +1,9 @@ # Reference +0. []() +0. [](https://github.com/MichaelMiR01/tcc4tcl) + 0. [](https://github.com/tcllab/tcc4tcl) + 0. [](https://github.com/cyanogilvie/tcc4tcl) 0. [Quirks of C](https://gist.github.com/fay59/5ccbe684e6e56a7df8815c3486568f01) 0. [C Isn't A Programming Language Anymore](https://gankra.github.io/blah/c-isnt-a-language/) 0. [Functional C](https://ris.utwente.nl/ws/portalfiles/portal/5128727/book.pdf) diff --git a/documentation/bookmark/compilation/target/clr.md b/documentation/bookmark/compilation/target/clr.md new file mode 100644 index 000000000..f6e244f9a --- /dev/null +++ b/documentation/bookmark/compilation/target/clr.md @@ -0,0 +1,5 @@ +# Reference + +0. []() +0. [Turbocharged: Writing High-Performance C# and .NET Code](https://www.youtube.com/watch?v=bhq1dzQzJ0E) + diff --git a/documentation/bookmark/back_end/go.md b/documentation/bookmark/compilation/target/go.md index 6d25fd45d..6d25fd45d 100644 --- a/documentation/bookmark/back_end/go.md +++ b/documentation/bookmark/compilation/target/go.md diff --git a/documentation/bookmark/back_end/Godot.md b/documentation/bookmark/compilation/target/godot.md index 354e87e96..354e87e96 100644 --- a/documentation/bookmark/back_end/Godot.md +++ b/documentation/bookmark/compilation/target/godot.md diff --git a/documentation/bookmark/back_end/graal.md b/documentation/bookmark/compilation/target/graal.md index bd91d9218..bd91d9218 100644 --- a/documentation/bookmark/back_end/graal.md +++ b/documentation/bookmark/compilation/target/graal.md diff --git a/documentation/bookmark/back_end/haskell.md b/documentation/bookmark/compilation/target/haskell.md index b54c23945..b54c23945 100644 --- a/documentation/bookmark/back_end/haskell.md +++ b/documentation/bookmark/compilation/target/haskell.md diff --git a/documentation/bookmark/back_end/haxe.md b/documentation/bookmark/compilation/target/haxe.md index d9aa29d2d..d9aa29d2d 100644 --- a/documentation/bookmark/back_end/haxe.md +++ b/documentation/bookmark/compilation/target/haxe.md diff --git a/documentation/bookmark/compilation/target/js.md b/documentation/bookmark/compilation/target/js.md deleted file mode 100644 index b6ea6916e..000000000 --- a/documentation/bookmark/compilation/target/js.md +++ /dev/null @@ -1,5 +0,0 @@ -# Reference - -0. [How JavaScript Array Works Internally?](https://blog.gauravthakur.in/how-javascript-array-works-internally) -0. [Maybe you don't need Rust and WASM to speed up your JS ](https://mrale.ph/blog/2018/02/03/maybe-you-dont-need-rust-to-speed-up-your-js.html) - diff --git a/documentation/bookmark/compilation/target/js__javascript.md b/documentation/bookmark/compilation/target/js__javascript.md new file mode 100644 index 000000000..e345bf4c4 --- /dev/null +++ b/documentation/bookmark/compilation/target/js__javascript.md @@ -0,0 +1,14 @@ +# Reference + +0. [How JavaScript Array Works Internally?](https://blog.gauravthakur.in/how-javascript-array-works-internally) +0. [Maybe you don't need Rust and WASM to speed up your JS ](https://mrale.ph/blog/2018/02/03/maybe-you-dont-need-rust-to-speed-up-your-js.html) + +# Debugging + +0. [The JavaScript Self-Profiling API](https://addyosmani.com/blog/js-self-profiling/) + +# Number + +0. [BigInt: arbitrary-precision integers in JavaScript](https://v8.dev/features/bigint) +0. [WebAssembly integration with JavaScript BigInt](https://v8.dev/features/wasm-bigint) + diff --git a/documentation/bookmark/back_end/llvm.md b/documentation/bookmark/compilation/target/llvm.md index 55a99f6e8..55a99f6e8 100644 --- a/documentation/bookmark/back_end/llvm.md +++ b/documentation/bookmark/compilation/target/llvm.md diff --git a/documentation/bookmark/back_end/micro_controller.md b/documentation/bookmark/compilation/target/micro_controller.md index 2681cbf67..2681cbf67 100644 --- a/documentation/bookmark/back_end/micro_controller.md +++ b/documentation/bookmark/compilation/target/micro_controller.md diff --git a/documentation/bookmark/back_end/native.md b/documentation/bookmark/compilation/target/native.md index 32da388c9..32da388c9 100644 --- a/documentation/bookmark/back_end/native.md +++ b/documentation/bookmark/compilation/target/native.md diff --git a/documentation/bookmark/back_end/python.md b/documentation/bookmark/compilation/target/python.md index 5113bb712..5113bb712 100644 --- a/documentation/bookmark/back_end/python.md +++ b/documentation/bookmark/compilation/target/python.md diff --git a/documentation/bookmark/back_end/rust.md b/documentation/bookmark/compilation/target/rust.md index f38b36966..f38b36966 100644 --- a/documentation/bookmark/back_end/rust.md +++ b/documentation/bookmark/compilation/target/rust.md diff --git a/documentation/bookmark/back_end/scopes.md b/documentation/bookmark/compilation/target/scopes.md index cd938a3ad..cd938a3ad 100644 --- a/documentation/bookmark/back_end/scopes.md +++ b/documentation/bookmark/compilation/target/scopes.md diff --git a/documentation/bookmark/back_end/wasm.md b/documentation/bookmark/compilation/target/wasm.md index 4ad7a40e9..e90bcd654 100644 --- a/documentation/bookmark/back_end/wasm.md +++ b/documentation/bookmark/compilation/target/wasm.md @@ -1,19 +1,23 @@ # Interoperability +0. []() 0. [How to Extend WebAssembly with Host Functions](https://www.secondstate.io/articles/extend-webassembly/) 0. [js-wasm: JavaScript and WebAssembly should be a joy to use together.](https://wasm.js.org/) # Concurrency +0. []() 0. [Wasm threads are now available in all browsers](https://old.reddit.com/r/WebAssembly/comments/rk83mr/wasm_threads_are_now_available_in_all_browsers/) # Platform +0. []() 0. [Wasmer Java](https://github.com/wasmerio/wasmer-java) 0. [WAVM: WAVM is a WebAssembly virtual machine, designed for use in non-web applications.](https://wavm.github.io/) # Exemplar +0. []() 0. [Announcing GraalWasm — a WebAssembly engine in GraalVM](https://medium.com/graalvm/announcing-graalwasm-a-webassembly-engine-in-graalvm-25cd0400a7f2) 0. [Towards a WebAssembly standalone runtime on GraalVM](https://dl.acm.org/citation.cfm?id=3362780) 0. https://github.com/vvanders/wasm_lua @@ -22,6 +26,8 @@ # Reference +0. []() +0. [TeaVM: Build Fast, Modern Web Apps in Java](https://teavm.org/) 0. [Recommendations when publishing a Wasm library](https://nickb.dev/blog/recommendations-when-publishing-a-wasm-library) 0. [Building host implementations for WebAssembly interfaces](https://radu-matei.com/blog/wasm-components-host-implementations/) 0. [WebAssembly Techniques to Speed Up Matrix Multiplication by 120x](https://jott.live/markdown/mm_wasm) diff --git a/documentation/bookmark/back_end/wren.md b/documentation/bookmark/compilation/target/wren.md index 8649c720b..8649c720b 100644 --- a/documentation/bookmark/back_end/wren.md +++ b/documentation/bookmark/compilation/target/wren.md diff --git a/documentation/bookmark/concurrency/actor.md b/documentation/bookmark/concurrency/actor.md index 0d4019add..42f86a5f1 100644 --- a/documentation/bookmark/concurrency/actor.md +++ b/documentation/bookmark/concurrency/actor.md @@ -1,5 +1,8 @@ # Reference +0. []() +0. [syn: A scalable global Process Registry and Process Group manager for Erlang and Elixir.](https://github.com/ostinelli/syn) +0. [Syndicated Actor model](https://syndicate-lang.org/) 0. [proto.actor](https://proto.actor/) 0. [otplike – Erlang/OTP processes and behaviours for Clojure - Alexey Aristov](https://www.youtube.com/watch?v=nHvRbZZhUDQ) diff --git a/documentation/bookmark/cooling.md b/documentation/bookmark/cooling.md new file mode 100644 index 000000000..aacf704c3 --- /dev/null +++ b/documentation/bookmark/cooling.md @@ -0,0 +1,5 @@ +# Reference + +0. []() +0. [Forget Heat Pumps - This House Cools Itself With NO Electricity!](https://www.youtube.com/watch?v=UB_ima2t_xU) + diff --git a/documentation/bookmark/data/structure/probabilistic.md b/documentation/bookmark/data/structure/probabilistic.md index dd769409d..f070cc423 100644 --- a/documentation/bookmark/data/structure/probabilistic.md +++ b/documentation/bookmark/data/structure/probabilistic.md @@ -1,10 +1,13 @@ # Hash function +0. []() 0. http://fastcompression.blogspot.com/2019/03/presenting-xxh3.html 0. http://cyan4973.github.io/xxHash/ # Reference +0. []() +0. [HyperLogLog in Presto: A significantly faster way to handle cardinality estimation](https://engineering.fb.com/2018/12/13/data-infrastructure/hyperloglog/) 0. [Ribbon Filter](http://rocksdb.org/blog/2021/12/29/ribbon-filter.html) 0. [Binary Fuse Filters: Fast and Smaller Than Xor Filters](https://arxiv.org/abs/2201.01174) 0. [Ribbon filter: practically smaller than Bloom and Xor](https://arxiv.org/abs/2103.02515) @@ -32,6 +35,7 @@ ## Bloom filter +0. []() 0. [Sliding Bloom Filter](https://programming.guide/sliding-bloom-filter.html) 0. [Word-aligned Bloom filters](https://lemire.me/blog/2021/10/03/word-aligned-bloom-filters/) 0. [Bloom Filters by Example](https://llimllib.github.io/bloomfilter-tutorial/) diff --git a/documentation/bookmark/database.md b/documentation/bookmark/database.md index b2fb5591e..56bd1fdc6 100644 --- a/documentation/bookmark/database.md +++ b/documentation/bookmark/database.md @@ -132,6 +132,8 @@ ## General +0. []() +0. [Skytable](https://skytable.io/) 0. https://github.com/Workiva/eva/ 0. https://learndb.net/ 0. http://orientdb.com/ diff --git a/documentation/bookmark/design/system.md b/documentation/bookmark/design/system.md new file mode 100644 index 000000000..6f825ace3 --- /dev/null +++ b/documentation/bookmark/design/system.md @@ -0,0 +1,5 @@ +# Reference + +0. []() +0. [Naming conventions for design systems](https://backlight.dev/blog/naming-conventions-for-design-systems) + diff --git a/documentation/bookmark/distributed_programming.md b/documentation/bookmark/distributed_programming.md index c3b6edf46..1bcff95f2 100644 --- a/documentation/bookmark/distributed_programming.md +++ b/documentation/bookmark/distributed_programming.md @@ -1,106 +1,120 @@ # Microservices -1. [The seven deceptions of microservices](https://scottrogowski.com/the-seven-deceptions-of-microservices.html) +0. []() +0. [The seven deceptions of microservices](https://scottrogowski.com/the-seven-deceptions-of-microservices.html) # Synchronization -1. [Braid: Synchronization for HTTP](https://braid.news/) -1. [The Braid Protocol: Synchronization for HTTP](https://tools.ietf.org/html/draft-toomim-braid-00) +0. []() +0. [Braid: Synchronization for HTTP](https://braid.news/) +0. [The Braid Protocol: Synchronization for HTTP](https://tools.ietf.org/html/draft-toomim-braid-00) # Reference -1. [No more DSLs: Implement and deploy a distributed system with a single program](http://catern.com/integration.html) -1. [Ambients: Peer-to-Peer Programs and Data](https://ipfs.io/ipfs/QmPhPJE55GvqSz7Pwvkc8n9dbKmqGw6tUGTE1MgfNQvzsf) -1. [Bastion: Highly-available Distributed Fault-tolerant Runtime](https://bastion.rs/) -1. [DDD and Messaging Architectures: An overview of my different series on patterns in distributed systems.](http://verraes.net/2019/05/ddd-msg-arch/) -1. https://replicated.cc/ -1. http://www.the-paper-trail.org/post/2014-08-09-distributed-systems-theory-for-the-distributed-systems-engineer/ -1. https://courses.engr.illinois.edu/cs525/sp2018/index.html -1. https://arxiv.org/abs/1701.07615 -1. http://proto.actor/ -1. https://blog.acolyer.org/2015/10/15/ironfleet-proving-practical-distributed-systems-correc/ -1. http://pythonsweetness.tumblr.com/post/165366346547/mitogen-an-infrastructure-code-baseline-that -1. https://github.com/heathermiller/dist-prog-book -1. https://lasp-lang.readme.io/ -1. https://speakerdeck.com/cmeiklejohn/practical-evaluation-of-the-lasp-programming-model-at-scale -1. http://bloom-lang.net/ -1. https://www.oreilly.com/ideas/scaling-a-startup-with-a-21st-century-language -1. https://github.com/grailbio/reflow -1. https://github.com/reactors-io/reactors -1. http://funcool.github.io/urania/latest/ -1. https://raft.github.io/ -1. https://github.com/ashwin153/caustic -1. http://prl.ccs.neu.edu/blog/2017/10/22/monotonicity-types-towards-a-type-system-for-eventual-consistency/ -1. http://www.swirlds.com/ -1. [Whip: Higher-Order Contracts for Modern Services](https://people.seas.harvard.edu/~chong/pubs/icfp17-whip.pdf &&& https://www.youtube.com/watch?v=phHrSC6pkXU) -1. https://channel9.msdn.com/Shows/On-NET/Orleans-onNET -1. [A Meta-EDSL for Distributed Web Applications](https://www.youtube.com/watch?v=Xzv6CfyXUdM) -1. https://en.wikipedia.org/wiki/Petriscript -1. [Fallacies of Distributed Computing Explained](http://www.rgoarchitects.com/Files/fallacies.pdf) -1. https://abhishek-tiwari.com/friends-dont-let-friends-build-data-pipelines/ -1. [Differential Synchronization](https://neil.fraser.name/writing/sync/) -1. https://medium.com/@mycoralhealth/why-blockchains-dont-suck-and-the-perils-of-distributed-databases-1a522cc7cfe1 -1. [The Remote Monad](http://www.ittc.ku.edu/research/thesis/documents/justin_dawson_thesis.pdf) -1. https://blog.acolyer.org/2017/08/17/on-the-design-of-distributed-programming-models/ -1. https://twitter.com/ifesdjeen/status/1024775959961128961 -1. https://sekniqi.com/blog/a-distributed-systems-primer-for-non-experts.html -1. [numpywren: serverless linear algebra](https://arxiv.org/abs/1810.09679) -1. https://hackernoon.com/a-thorough-introduction-to-distributed-systems-3b91562c9b3c -1. ["Towards Language Support for Distributed Systems" by Heather Miller](https://www.youtube.com/watch?v=IeBbiQZYmuY) -1. http://jepsen.io/ -1. [Think Local: Reducing Coordination and Improving Performance when Designing around Distributed State](https://vimeo.com/304106598) -1. [Introducing AMBROSIA: a new platform for reliable distributed applications without all the hassle](https://cloudblogs.microsoft.com/opensource/2018/12/13/introducing-ambrosia-new-platform-distributed-applications/) -1. https://distributedobjectprotocol.org/ -1. https://medium.com/bitfinex/introducing-svc-js-a-framework-for-grenache-7119f2d7769e -1. http://dbmsmusings.blogspot.com/2019/01/its-time-to-move-on-from-two-phase.html +0. []() +0. [The Art of Immutable Architecture](https://www.immutablearchitecture.com/) +0. [No more DSLs: Implement and deploy a distributed system with a single program](http://catern.com/integration.html) +0. [Ambients: Peer-to-Peer Programs and Data](https://ipfs.io/ipfs/QmPhPJE55GvqSz7Pwvkc8n9dbKmqGw6tUGTE1MgfNQvzsf) +0. [Bastion: Highly-available Distributed Fault-tolerant Runtime](https://bastion.rs/) +0. [DDD and Messaging Architectures: An overview of my different series on patterns in distributed systems.](http://verraes.net/2019/05/ddd-msg-arch/) +0. https://replicated.cc/ +0. http://www.the-paper-trail.org/post/2014-08-09-distributed-systems-theory-for-the-distributed-systems-engineer/ +0. https://courses.engr.illinois.edu/cs525/sp2018/index.html +0. https://arxiv.org/abs/1701.07615 +0. http://proto.actor/ +0. https://blog.acolyer.org/2015/10/15/ironfleet-proving-practical-distributed-systems-correc/ +0. http://pythonsweetness.tumblr.com/post/165366346547/mitogen-an-infrastructure-code-baseline-that +0. https://github.com/heathermiller/dist-prog-book +0. https://lasp-lang.readme.io/ +0. https://speakerdeck.com/cmeiklejohn/practical-evaluation-of-the-lasp-programming-model-at-scale +0. http://bloom-lang.net/ +0. https://www.oreilly.com/ideas/scaling-a-startup-with-a-21st-century-language +0. https://github.com/grailbio/reflow +0. https://github.com/reactors-io/reactors +0. http://funcool.github.io/urania/latest/ +0. https://raft.github.io/ +0. https://github.com/ashwin153/caustic +0. http://prl.ccs.neu.edu/blog/2017/10/22/monotonicity-types-towards-a-type-system-for-eventual-consistency/ +0. http://www.swirlds.com/ +0. [Whip: Higher-Order Contracts for Modern Services](https://people.seas.harvard.edu/~chong/pubs/icfp17-whip.pdf &&& https://www.youtube.com/watch?v=phHrSC6pkXU) +0. https://channel9.msdn.com/Shows/On-NET/Orleans-onNET +0. [A Meta-EDSL for Distributed Web Applications](https://www.youtube.com/watch?v=Xzv6CfyXUdM) +0. https://en.wikipedia.org/wiki/Petriscript +0. [Fallacies of Distributed Computing Explained](http://www.rgoarchitects.com/Files/fallacies.pdf) +0. https://abhishek-tiwari.com/friends-dont-let-friends-build-data-pipelines/ +0. [Differential Synchronization](https://neil.fraser.name/writing/sync/) +0. https://medium.com/@mycoralhealth/why-blockchains-dont-suck-and-the-perils-of-distributed-databases-1a522cc7cfe1 +0. [The Remote Monad](http://www.ittc.ku.edu/research/thesis/documents/justin_dawson_thesis.pdf) +0. https://blog.acolyer.org/2017/08/17/on-the-design-of-distributed-programming-models/ +0. https://twitter.com/ifesdjeen/status/1024775959961128961 +0. https://sekniqi.com/blog/a-distributed-systems-primer-for-non-experts.html +0. [numpywren: serverless linear algebra](https://arxiv.org/abs/1810.09679) +0. https://hackernoon.com/a-thorough-introduction-to-distributed-systems-3b91562c9b3c +0. ["Towards Language Support for Distributed Systems" by Heather Miller](https://www.youtube.com/watch?v=IeBbiQZYmuY) +0. http://jepsen.io/ +0. [Think Local: Reducing Coordination and Improving Performance when Designing around Distributed State](https://vimeo.com/304106598) +0. [Introducing AMBROSIA: a new platform for reliable distributed applications without all the hassle](https://cloudblogs.microsoft.com/opensource/2018/12/13/introducing-ambrosia-new-platform-distributed-applications/) +0. https://distributedobjectprotocol.org/ +0. https://medium.com/bitfinex/introducing-svc-js-a-framework-for-grenache-7119f2d7769e +0. http://dbmsmusings.blogspot.com/2019/01/its-time-to-move-on-from-two-phase.html # Rate limiting -1. https://blog.ably.io/how-adopting-a-distributed-rate-limiting-helps-scale-your-platform-1afdf3944b5a +0. []() +0. https://blog.ably.io/how-adopting-a-distributed-rate-limiting-helps-scale-your-platform-1afdf3944b5a # Programming language -1. [Choral: a choreographic programming language](https://www.choral-lang.org/) -1. ["Unison: a new distributed programming language" by Paul Chiusano](https://www.youtube.com/watch?v=gCWtkvDQ2ZI) -1. http://radicle.xyz/ -1. [Lambda World 2018 - Introduction to the Unison programming language - Rúnar Bjarnason](https://www.youtube.com/watch?v=rp_Eild1aq8) -1. https://www.infoq.com/presentations/language-design-process +0. []() +0. [Choral: a choreographic programming language](https://www.choral-lang.org/) +0. ["Unison: a new distributed programming language" by Paul Chiusano](https://www.youtube.com/watch?v=gCWtkvDQ2ZI) +0. http://radicle.xyz/ +0. [Lambda World 2018 - Introduction to the Unison programming language - Rúnar Bjarnason](https://www.youtube.com/watch?v=rp_Eild1aq8) +0. https://www.infoq.com/presentations/language-design-process # Parallel commit -1. [Parallel Commits: An Atomic Commit Protocol For Globally Distributed Transactions](https://www.cockroachlabs.com/blog/parallel-commits) +0. []() +0. [Parallel Commits: An Atomic Commit Protocol For Globally Distributed Transactions](https://www.cockroachlabs.com/blog/parallel-commits) # Two-phase commit -1. https://shekhargulati.com/2018/09/05/two-phase-commit-protocol/ +0. []() +0. https://shekhargulati.com/2018/09/05/two-phase-commit-protocol/ # Linearizability -1. https://ristret.com/s/uqin9q/mild_generalization_linearizability -1. https://en.wikipedia.org/wiki/Vector_clock +0. []() +0. https://ristret.com/s/uqin9q/mild_generalization_linearizability +0. https://en.wikipedia.org/wiki/Vector_clock # Exemplar -1. http://meshbird.com/ +0. []() +0. http://meshbird.com/ # Logical clock -1. [Interval Tree Clocks](https://ferd.ca/interval-tree-clocks.html) -1. [Version Vectors are not Vector Clocks](https://haslab.wordpress.com/2011/07/08/version-vectors-are-not-vector-clocks/) -1. [Distributed Systems: Physical, Logical, and Vector Clocks](https://levelup.gitconnected.com/distributed-systems-physical-logical-and-vector-clocks-7ca989f5f780) -1. [The Bloom Clock](https://arxiv.org/pdf/1905.13064.pdf) -1. [Why Logical Clocks are Easy: Sometimes all you need is the right language.](https://queue.acm.org/detail.cfm?id=2917756) +0. []() +0. [Interval Tree Clocks](https://ferd.ca/interval-tree-clocks.html) +0. [Version Vectors are not Vector Clocks](https://haslab.wordpress.com/2011/07/08/version-vectors-are-not-vector-clocks/) +0. [Distributed Systems: Physical, Logical, and Vector Clocks](https://levelup.gitconnected.com/distributed-systems-physical-logical-and-vector-clocks-7ca989f5f780) +0. [The Bloom Clock](https://arxiv.org/pdf/1905.13064.pdf) +0. [Why Logical Clocks are Easy: Sometimes all you need is the right language.](https://queue.acm.org/detail.cfm?id=2917756) # Consensus protocol -1. https://medium.com/s/story/lets-take-a-crack-at-understanding-distributed-consensus-dad23d0dc95 -1. [Spectrum: A Framework for Adapting Consensus Protocols](https://arxiv.org/abs/1902.05873) +0. []() +0. https://medium.com/s/story/lets-take-a-crack-at-understanding-distributed-consensus-dad23d0dc95 +0. [Spectrum: A Framework for Adapting Consensus Protocols](https://arxiv.org/abs/1902.05873) # Locality -1. [Think Local: Reducing Coordination and Improving Performance when Designing around Distributed State](https://vimeo.com/304106598) +0. []() +0. [Think Local: Reducing Coordination and Improving Performance when Designing around Distributed State](https://vimeo.com/304106598) # Distributed transaction -1. [Life beyond Distributed Transactions: an Apostate’s Opinion](http://adrianmarriott.net/logosroot/papers/LifeBeyondTxns.pdf) +0. []() +0. [Life beyond Distributed Transactions: an Apostate’s Opinion](http://adrianmarriott.net/logosroot/papers/LifeBeyondTxns.pdf) diff --git a/documentation/bookmark/documentation.md b/documentation/bookmark/documentation.md index 414242336..97b9ec1bd 100644 --- a/documentation/bookmark/documentation.md +++ b/documentation/bookmark/documentation.md @@ -66,6 +66,7 @@ # Reference 0. []() +0. [Mintlify Writer](https://www.mintlify.com/writer) 0. [TimelineJS: Easy-to-make, beautiful timelines.](http://timeline.knightlab.com/) 0. [Introduction to the Zettelkasten Method](https://zettelkasten.de/introduction/) 0. [Building a community of open-source documentation contributors](https://news.ycombinator.com/newest?next=31705868&n=1171) diff --git a/documentation/bookmark/floating_point.md b/documentation/bookmark/floating_point.md index a344106c2..30e072479 100644 --- a/documentation/bookmark/floating_point.md +++ b/documentation/bookmark/floating_point.md @@ -1,44 +1,58 @@ +# Printing + +0. []() +0. [Dragonbox](https://github.com/jk-jeon/dragonbox) + # Parsing +0. []() 0. [fast_float number parsing library: 4x faster than strtod](https://github.com/fastfloat/fast_float) 0. [Fast float parsing in practice](https://lemire.me/blog/2020/03/10/fast-float-parsing-in-practice/) # Precision +0. []() 0. [Calcium](https://fredrikj.net/calcium/) 0. [Accuracy of Mathematical Functions in Single, Double, Double Extended, and Quadruple Precision](https://members.loria.fr/PZimmermann/papers/accuracy.pdf) 0. [Supporting half-precision floats is really annoying](https://futhark-lang.org/blog/2021-08-05-half-precision-floats.html) # Debugging +0. []() 0. [Keynote: William Kahan - Debugging Tools for Floating-Point Code](https://www.youtube.com/watch?v=qHddEkfQBrA) # Comparison +0. []() 0. [Comparing Floating-Point Numbers Is Tricky](https://www.youtube.com/watch?v=iW7H1KfSJ8s) 0. [Approximate Equality for Floating Point](https://github.com/apple/swift-evolution/blob/master/proposals/0259-approximately-equal.md) # Random generation +0. []() 0. [Drawing random floating-point numbers from an interval](https://hal.archives-ouvertes.fr/hal-03282794/document) 0. [Uniform random floats: How to generate a double-precision floating-point number in [0, 1] uniformly at random given a uniform random source of bits](https://mumble.net/~campbell/2014/04/28/uniform-random-float) # Correctness +0. []() 0. [Floating point expression inspector](https://github.com/graphitemaster/fpinspect) 0. [Herbie: Find and fix floating-point problems.](https://herbie.uwplse.org/) # Format +0. []() 0. [decimal128 floating-point format](https://en.wikipedia.org/wiki/Decimal128_floating-point_format) # Reference +0. []() 0. [How Java’s Floating-Point Hurts Everyone Everywhere](https://people.eecs.berkeley.edu/~wkahan/JAVAhurt.pdf) 0. [What aspect of portable floating point did Java back down on?](https://retrocomputing.stackexchange.com/questions/18143/what-aspect-of-portable-floating-point-did-java-back-down-on) # Algorithm +0. []() 0. [Speeding up atan2f by 50x](https://mazzo.li/posts/vectorized-atan2.html) 0. [Kahan summation algorithm](https://en.wikipedia.org/wiki/Kahan_summation_algorithm) diff --git a/documentation/bookmark/fluidics.md b/documentation/bookmark/fluidics.md new file mode 100644 index 000000000..d75c1f4e2 --- /dev/null +++ b/documentation/bookmark/fluidics.md @@ -0,0 +1,6 @@ +# Reference + +0. []() +0. [Water integrator](https://en.wikipedia.org/wiki/Water_integrator) +0. [Fluidics](https://en.wikipedia.org/wiki/Fluidics) + diff --git a/documentation/bookmark/game/balance.md b/documentation/bookmark/game/balance.md new file mode 100644 index 000000000..7ffba1bbf --- /dev/null +++ b/documentation/bookmark/game/balance.md @@ -0,0 +1,6 @@ +# Reference + +0. []() +0. [PAX South 2018 -- Balance in Game Design](https://www.youtube.com/watch?v=NXD8YQ7j_Qk) +0. [How "Bad" Balance Can Be A Good Thing](https://www.youtube.com/watch?v=l1WYmHz3hog) + diff --git a/documentation/bookmark/game/mechanic/enemy.md b/documentation/bookmark/game/mechanic/enemy.md index 51004cd3c..ccf7fdf1d 100644 --- a/documentation/bookmark/game/mechanic/enemy.md +++ b/documentation/bookmark/game/mechanic/enemy.md @@ -1,5 +1,7 @@ # Reference +0. []() +0. [Make Your DnD Monsters Weirder! Bestial Ecosystems Created by Monstrous Inhabitation Review](https://www.youtube.com/watch?v=Txpdb5CYX_Y) 0. [Revamping Ghosts as Monsters for Halloween || D&D with Dael Kingsmill](https://www.youtube.com/watch?v=RlHom7zSWD0) 0. [How Do You Design a Cast of Enemies? ~ Design Doc](https://www.youtube.com/watch?v=RvrVicqDhKI) diff --git a/documentation/bookmark/game/speedrun.md b/documentation/bookmark/game/speedrun.md new file mode 100644 index 000000000..4efd6ac6f --- /dev/null +++ b/documentation/bookmark/game/speedrun.md @@ -0,0 +1,5 @@ +# Reference + +0. []() +0. [What Makes A Game Speedrun Friendly?](https://www.youtube.com/watch?v=ixmOKhM_AlI) + diff --git a/documentation/bookmark/game/storytelling.md b/documentation/bookmark/game/storytelling.md index 2bde03394..28613b8b1 100644 --- a/documentation/bookmark/game/storytelling.md +++ b/documentation/bookmark/game/storytelling.md @@ -1,6 +1,7 @@ # Reference 0. []() +0. [Sparking Curiosity-Driven Exploration Through Narrative in 'Outer Wilds'](https://www.youtube.com/watch?v=QaGu9tGCNbI) 0. [Approaching a Pedagogy of Game Writing](https://www.youtube.com/watch?v=24HHIKOA1ZA) 0. [I Beg You, Please Cripple Your Characters](https://www.youtube.com/watch?v=DGe6ehr0dxs) 0. [Press Y to Cry: Generating Emotions in Videogame Narrative](https://www.youtube.com/watch?v=_lp0libfp5M) diff --git a/documentation/bookmark/graphic/3d/shading.md b/documentation/bookmark/graphic/3d/shading.md new file mode 100644 index 000000000..c184858f9 --- /dev/null +++ b/documentation/bookmark/graphic/3d/shading.md @@ -0,0 +1,5 @@ +# Reference + +0. []() +0. [Slang](https://github.com/shader-slang/slang) + diff --git a/documentation/bookmark/investing.md b/documentation/bookmark/investing.md index 4362effb6..66e9aea34 100644 --- a/documentation/bookmark/investing.md +++ b/documentation/bookmark/investing.md @@ -1,6 +1,7 @@ # Reference 0. []() +0. [Predictably Bad Investments: Evidence from Venture Capitalists](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4135861) 0. [Launch YC: The Launchpad for YC Startups](https://www.ycombinator.com/blog/launch-yc-the-launchpad-for-yc-startups) 0. [Launch YC: The Launchpad for YC Startups](https://www.ycombinator.com/launches) diff --git a/documentation/bookmark/license.md b/documentation/bookmark/license.md new file mode 100644 index 000000000..140f62fe6 --- /dev/null +++ b/documentation/bookmark/license.md @@ -0,0 +1,5 @@ +# Reference + +0. []() +0. [](https://github.com/topics/license-management) + diff --git a/documentation/bookmark/math.md b/documentation/bookmark/math.md index 9c36118ed..25c80c8cb 100644 --- a/documentation/bookmark/math.md +++ b/documentation/bookmark/math.md @@ -104,6 +104,7 @@ # _Compendium of resources_ 0. []() +0. [Real Not Complex](https://realnotcomplex.com/) 0. [How to Learn Advanced Mathematics Without Heading to University - Part 1](https://www.quantstart.com/articles/How-to-Learn-Advanced-Mathematics-Without-Heading-to-University-Part-1/) 0. [How to Learn Advanced Mathematics Without Heading to University - Part 2](https://www.quantstart.com/articles/How-to-Learn-Advanced-Mathematics-Without-Heading-to-University-Part-2/) 0. [How to Learn Advanced Mathematics Without Heading to University - Part 3](https://www.quantstart.com/articles/How-to-Learn-Advanced-Mathematics-Without-Heading-to-University-Part-3/) diff --git a/documentation/bookmark/memory_management/garbage_collection.md b/documentation/bookmark/memory_management/garbage_collection.md index 2652cc2a0..aa52ba50a 100644 --- a/documentation/bookmark/memory_management/garbage_collection.md +++ b/documentation/bookmark/memory_management/garbage_collection.md @@ -1,5 +1,7 @@ # Reference +0. []() +0. [A Guide to the Go Garbage Collector](https://tip.golang.org/doc/gc-guide) 0. [Distilling the Real Cost of Production Garbage Collectors](https://users.cecs.anu.edu.au/~steveb/pubs/papers/lbo-ispass-2022.pdf) 0. [Summarizing Garbage Collection](https://eschew.wordpress.com/2016/09/02/summarizing-gc/) diff --git a/documentation/bookmark/microprogramming.md b/documentation/bookmark/microprogramming.md new file mode 100644 index 000000000..cf6a969b9 --- /dev/null +++ b/documentation/bookmark/microprogramming.md @@ -0,0 +1,5 @@ +# Reference + +0. []() +0. [A Brief History of Microprogramming](https://people.cs.clemson.edu/~mark/uprog.html) + diff --git a/documentation/bookmark/open_source.md b/documentation/bookmark/open_source.md index 0bf73c741..a2f0da365 100644 --- a/documentation/bookmark/open_source.md +++ b/documentation/bookmark/open_source.md @@ -1,5 +1,7 @@ # Reference +0. []() +0. [Trust Signals in Open Source Projects](https://hackernoon.com/the-signs-of-a-great-open-source-project) 0. [Awesome OSS Monetization](https://paydevs.github.io/awesome-oss-monetization/) 0. [Open Source Guides](https://opensource.guide/) 0. [Uncurled - everything I know and learned about running and maintaining Open Source projects for three decades.](https://un.curl.dev/) diff --git a/documentation/bookmark/open_source/commercialization.md b/documentation/bookmark/open_source/commercialization.md new file mode 100644 index 000000000..2afcb3506 --- /dev/null +++ b/documentation/bookmark/open_source/commercialization.md @@ -0,0 +1,5 @@ +# Reference + +0. []() +0. [Better Than Free](https://kk.org/thetechnium/better-than-fre/) + diff --git a/documentation/bookmark/optics.md b/documentation/bookmark/optics.md index 314505037..2c102073c 100644 --- a/documentation/bookmark/optics.md +++ b/documentation/bookmark/optics.md @@ -1,5 +1,7 @@ # Reference +0. []() +0. [Profunctor Optics: The Categorical View](https://golem.ph.utexas.edu/category/2020/01/profunctor_optics_the_categori.html) 0. [Existential optics](https://www.tweag.io/blog/2022-05-05-existential-optics/) 0. [Optics vs Lenses, Operationally](https://www.brunogavranovic.com/posts/2022-02-10-optics-vs-lenses-operationally.html) 0. [Optics By Example](https://leanpub.com/optics-by-example) @@ -7,7 +9,8 @@ 0. [On Lawful Lenses](https://blog.statebox.org/on-lawful-lenses-6e18a1e17bdf) 0. https://medium.com/urbint-engineering/haskell-lens-operator-onboarding-a235481e8fac 0. https://fstarlang.github.io/general/2018/01/12/lens-indexed-lenses.html -0. [Jeremy Gibbons - Profunctor Optics Modular Data Accessors](https://www.youtube.com/watch?v=sfWzUMViP0M &&& http://www.cs.ox.ac.uk/people/jeremy.gibbons/publications/poptics.pdf) +0. [Jeremy Gibbons - Profunctor Optics Modular Data Accessors](https://www.youtube.com/watch?v=sfWzUMViP0M) + 0. [Profunctor Optics: Modular Data Accessors](http://www.cs.ox.ac.uk/people/jeremy.gibbons/publications/poptics.pdf) 0. http://hackage.haskell.org/package/profunctors-3.3.0.1/docs/Data-Profunctor.html 0. https://github.com/purescript-contrib/purescript-profunctor-lenses 0. https://hackage.haskell.org/package/lens-4.16/docs/Control-Lens-Indexed.html diff --git a/documentation/bookmark/optimization.md b/documentation/bookmark/optimization.md index 3ccbed5ac..7e7b7d851 100644 --- a/documentation/bookmark/optimization.md +++ b/documentation/bookmark/optimization.md @@ -1,31 +1,39 @@ # Inlining +0. []() 0. [Defunctionalization](https://en.wikipedia.org/wiki/Defunctionalization) # Hashing +0. []() 0. [Fibonacci Hashing: The Optimization that the World Forgot (or: a Better Alternative to Integer Modulo)](https://probablydance.com/2018/06/16/fibonacci-hashing-the-optimization-that-the-world-forgot-or-a-better-alternative-to-integer-modulo/) # Compilation +0. []() 0. ["Outperforming Imperative with Pure Functional Languages" by Richard Feldman](https://www.youtube.com/watch?v=vzfy4EKwG_Y) 0. [CompilerGym: Making compiler optimizations accessible to all](https://ai.facebook.com/blog/compilergym-making-compiler-optimizations-accessible-to-all) 0. [Future Directions for Optimizing Compilers](https://arxiv.org/abs/1809.02161) # Pre-fetching +0. []() 0. [Prefetching in Functional Languages](https://www.cl.cam.ac.uk/~tmj32/papers/docs/ainsworth20-ismm.pdf) # Partial evaluation +0. []() 0. [AnyDSL - A Partial Evaluation Framework for Programming High-Performance Libraries](https://anydsl.github.io/) # For the compiler +0. []() 0. [Self Hosting a Million-Lines-Per-Second Parser](https://bjou-lang.org/blog/7-10-2019-self-hosting-a-million-lines-per-second-parser/7-10-2019-self-hosting-a-million-lines-per-second-parser.html) # Reference +0. []() +0. [Software optimization resources](https://www.agner.org/optimize/) 0. [Finding Missed Optimizations through the Lens of Dead Code Elimination](https://ethz.ch/content/dam/ethz/special-interest/infk/ast-dam/documents/Theodoridis-ASPLOS22-DCE-Paper.pdf) 0. [Algorithms for Modern Hardware](https://en.algorithmica.org/hpc/) 0. [Refterm Lecture Part 1 - Philosophies of Optimization](https://www.youtube.com/watch?v=pgoetgxecw8) @@ -63,5 +71,6 @@ # JavaScript +0. []() 0. [Javascript Array.push is 945x faster than Array.concat](https://dev.to/uilicious/javascript-array-push-is-945x-faster-than-array-concat-1oki) diff --git a/documentation/bookmark/optimization/compiler.md b/documentation/bookmark/optimization/compiler.md new file mode 100644 index 000000000..4c1f525c3 --- /dev/null +++ b/documentation/bookmark/optimization/compiler.md @@ -0,0 +1,6 @@ +# Reference + +0. []() +0. [Compiler Optimizations](https://compileroptimizations.com/) +0. [The Exo Language](https://exo-lang.dev/) + diff --git a/documentation/bookmark/recycling.md b/documentation/bookmark/recycling.md new file mode 100644 index 000000000..935a62251 --- /dev/null +++ b/documentation/bookmark/recycling.md @@ -0,0 +1,6 @@ +# Reference + +0. []() +0. [The Chemical Story Behind Non-Petroleum-Based Plastics](https://sustainable-nano.com/2014/06/26/the-chemical-story-behind-non-petroleum-based-plastics/) +0. [Plastic-eating superworms with ‘recycling plant’ in their guts might get a job gobbling up waste](https://www.youtube.com/watch?v=Ub1LBeNQDxw) + diff --git a/documentation/bookmark/security/authentication.md b/documentation/bookmark/security/authentication.md index 152f17b1b..dfa8900d4 100644 --- a/documentation/bookmark/security/authentication.md +++ b/documentation/bookmark/security/authentication.md @@ -1,6 +1,8 @@ # Reference 0. []() +0. [persona](https://withpersona.com/home-wf) +0. [Authentication is Difficult](https://blog.jchw.io/authentication-is-difficult/) 0. [A07:2021 – Identification and Authentication Failures ](https://owasp.org/Top10/A07_2021-Identification_and_Authentication_Failures/) 0. [The future of authentication is both stateful and stateless](https://clerk.dev/blog/future-of-auth-stateless-and-stateful) 0. [Move beyond passwords](https://developer.apple.com/videos/play/wwdc2021/10106/) diff --git a/documentation/bookmark/software/engineering/alert.md b/documentation/bookmark/software/engineering/alert.md new file mode 100644 index 000000000..91076dc7a --- /dev/null +++ b/documentation/bookmark/software/engineering/alert.md @@ -0,0 +1,5 @@ +# Reference + +0. []() +0. [Alerts, what are they good for?](https://medium.com/@tophatengblog/alerts-what-are-they-good-for-fe085e9ab4db) + diff --git a/documentation/bookmark/testing.md b/documentation/bookmark/testing.md index c28708d0e..f67c69688 100644 --- a/documentation/bookmark/testing.md +++ b/documentation/bookmark/testing.md @@ -1,33 +1,46 @@ # Concolic Testing +0. []() 0. [Robby Findler: Concolic Testing with Higher-Order Inputs](https://www.youtube.com/watch?v=aO9nOCqNdfQ) # Symbolic +0. []() 0. [Crux](https://crux.galois.com/) # White box +0. []() 0. [Ricardo Peña - White-Box Path Generation in Recursive Programs - Lambda Days 2020](https://www.youtube.com/watch?v=7RXJhPaQCkc) # Mocking +0. []() 0. [Testing Without Mocks: A Pattern Language](https://www.jamesshore.com/Blog/Testing-Without-Mocks.html) # Visual Testing +0. []() 0. [Stories are tests](https://storybook.js.org/blog/stories-are-tests/) 0. [Visual Testing Handbook](https://storybook.js.org/tutorials/visual-testing-handbook/) # Cross-Branch Testing +0. []() 0. [Cross-Branch Testing](https://www.hillelwayne.com/post/cross-branch-testing/) # Coverage +0. []() 0. [Modified condition/decision coverage](https://en.wikipedia.org/wiki/Modified_condition/decision_coverage) +# Property-based + +0. []() +0. [Property-based Testing Patterns](https://blog.ssanj.net/posts/2016-06-26-property-based-testing-patterns.html) + # Reference +0. []() 0. [Test Anything Protocol](http://testanything.org/) diff --git a/documentation/bookmark/testing/metamorphic.md b/documentation/bookmark/testing/metamorphic.md new file mode 100644 index 000000000..7432b3583 --- /dev/null +++ b/documentation/bookmark/testing/metamorphic.md @@ -0,0 +1,5 @@ +# Reference + +0. []() +0. [Metamorphic Testing of Version Control Systems](https://elib.uni-stuttgart.de/bitstream/11682/12221/1/MA_MetaVECTT_Reichel.pdf) + diff --git a/documentation/bookmark/user_interface/accessibility.md b/documentation/bookmark/user_interface/a11y__accessibility.md index 0880d713d..34eba799d 100644 --- a/documentation/bookmark/user_interface/accessibility.md +++ b/documentation/bookmark/user_interface/a11y__accessibility.md @@ -1,5 +1,7 @@ # Reference +0. []() +0. [a11yphant: Learning web accessibility made easy](https://a11yphant.com/) 0. [Inclusive Design Principles](https://inclusivedesignprinciples.org/) 0. [Making Accessibility More Accessible](https://austingil.com/making-accessibility-more-accessible/) 0. [Detecting Hover-Capable Devices](https://css-irl.info/detecting-hover-capable-devices/) diff --git a/lux-js/commands.md b/lux-js/commands.md index 34b4a750c..a71f5e2e8 100644 --- a/lux-js/commands.md +++ b/lux-js/commands.md @@ -20,16 +20,15 @@ cd ~/lux/lux-js/ \ && mv target/program.jar jvm_based_compiler.jar ## Use JVM-based compiler to produce a JS/Node-based compiler. -## @ library/lux/data/text TODO: Comment/turn-off when generating a JS compiler using a JVM-based compiler because Nashorn's implementation of "replaceAll" is incorrect. cd ~/lux/lux-js/ \ && lux clean \ -&& time java -jar jvm_based_compiler.jar build --source ~/lux/lux-js/source --target ~/lux/lux-js/target --module program \ +&& time java -jar jvm_based_compiler.jar build --source ~/lux/lux-js/source --target ~/lux/lux-js/target --module program --program _ \ && mv target/program.js node_based_compiler.js ## Use JS/Node-based compiler to produce another JS/Node-based compiler. cd ~/lux/lux-js/ \ && lux clean \ -&& node --stack_size=8192 node_based_compiler.js build --source ~/lux/lux-js/source --target ~/lux/lux-js/target --module program +&& node --stack_size=8192 node_based_compiler.js build --source ~/lux/lux-js/source --target ~/lux/lux-js/target --module program --program _ ``` # Try @@ -38,7 +37,7 @@ cd ~/lux/lux-js/ \ ## Compile Lux's Standard Library's tests using a JS/Node-based compiler. cd ~/lux/stdlib/ \ && lux clean \ -&& node --stack_size=8192 ~/lux/lux-js/target/program.js build --source ~/lux/stdlib/source --target ~/lux/stdlib/target --module test/lux \ +&& node --stack_size=8192 ~/lux/lux-js/target/program.js build --source ~/lux/stdlib/source --target ~/lux/stdlib/target --module test/lux --program _ \ && node ~/lux/stdlib/target/program.js ``` diff --git a/lux-js/project.lux b/lux-js/project.lux index c7be34e6f..7112c796f 100644 --- a/lux-js/project.lux +++ b/lux-js/project.lux @@ -1,5 +1,5 @@ ["" - ["identity" ["com.github.luxlang" "lux-js" "0.6.6-SNAPSHOT"] + ["identity" ["com.github.luxlang" "lux-js" "0.7.0-SNAPSHOT"] "info" ["url" "https://github.com/LuxLang/lux" "scm" "https://github.com/LuxLang/lux.git" "licenses" [["name" "Lux License v0.1.2" @@ -18,11 +18,12 @@ "dependencies" [... ["com.github.luxlang" "stdlib" "0.6.5" "tar"] ] - "program" "program"] + "program" program._] "js" - ["lux" ["com.github.luxlang" "lux-js" "0.6.6-SNAPSHOT" "js"]] + ["lux" ["com.github.luxlang" "lux-js" "0.7.0-SNAPSHOT" "js"]] "jvm" - ["lux" ["com.github.luxlang" "lux-jvm" "0.6.6-SNAPSHOT" "jar"] - "dependencies" [["org.openjdk.nashorn" "nashorn-core" "15.1" "jar"]]]] + ["lux" ["com.github.luxlang" "lux-jvm" "0.7.0-SNAPSHOT" "jar"] + "dependencies" [["com.github.luxlang" "lux-jvm-function" "0.6.5" "jar"] + ["org.openjdk.nashorn" "nashorn-core" "15.1" "jar"]]]] diff --git a/lux-js/source/program.lux b/lux-js/source/program.lux index c692a41a0..69656c4bc 100644 --- a/lux-js/source/program.lux +++ b/lux-js/source/program.lux @@ -22,9 +22,6 @@ ["[0]" utf8]]] [collection ["[0]" array (.only Array)]]] - [macro - ["^" pattern] - ["[0]" template]] [math [number ["n" nat] @@ -32,10 +29,13 @@ ["[0]" i64]]] ["[0]" world ["[0]" file] - ["[1]/[0]" program]] - ["@" target (.only) - ["_" js]] + ["[1]/[0]" environment]] [meta + ["@" target (.only) + ["_" js]] + [macro + ["^" pattern] + ["[0]" template]] [compiler ["[0]" phase (.only Operation Phase)] [reference @@ -56,7 +56,8 @@ [generation ["[0]" reference] ["[0]" js (.only) - ["[0]" runtime]]]]]] + ["[0]" runtime] + ["[1]/[0]" reference]]]]]] [default ["[0]" platform (.only Platform)]] [meta @@ -177,11 +178,17 @@ [] (getMember self [member java/lang/String]) java/lang/Object (case (ffi.of_string member) (static runtime.i64_high_field) - (|> value .nat runtime.high jvm_int + (|> value + .nat + runtime.high + jvm_int (ffi.is java/lang/Object)) (static runtime.i64_low_field) - (|> value .nat runtime.low jvm_int + (|> value + .nat + runtime.low + jvm_int (ffi.is java/lang/Object)) _ @@ -221,7 +228,7 @@ java/lang/Object (|> (java/util/Arrays::copyOfRange value (|> args - (array.read! 0) + (array.item 0) maybe.trusted (as Int) ffi.as_int) @@ -235,14 +242,18 @@ (-> (Array java/lang/Object) org/openjdk/nashorn/api/scripting/JSObject) (let [js_object (is (-> java/lang/Object org/openjdk/nashorn/api/scripting/JSObject) (function (_ sub_value) - (<| (case (ffi.is [java/lang/Object] sub_value) + (<| (case (ffi.as [java/lang/Object] sub_value) {.#Some sub_value} - (|> sub_value (as (Array java/lang/Object)) js_structure) + (|> sub_value + (as (Array java/lang/Object)) + js_structure) {.#None}) - (case (ffi.is java/lang/Long sub_value) + (case (ffi.as java/lang/Long sub_value) {.#Some sub_value} - (|> sub_value ffi.of_long js_int) + (|> sub_value + ffi.of_long + js_int) {.#None}) ... else @@ -252,10 +263,12 @@ [] ... Methods (StructureValue - [] (getValue self []) java/lang/Object - (ffi.is java/lang/Object value)) + [] (getValue self []) + java/lang/Object + (as java/lang/Object value)) (org/openjdk/nashorn/api/scripting/AbstractJSObject - [] (isArray self []) boolean + [] (isArray self []) + boolean (ffi.as_boolean #1)) (org/openjdk/nashorn/api/scripting/AbstractJSObject [] (getMember self [member java/lang/String]) @@ -277,11 +290,11 @@ (static runtime.variant_tag_field) (|> value - (array.read! 0) + (array.item 0) maybe.trusted) (static runtime.variant_flag_field) - (case (array.read! 1 value) + (case (array.item 1 value) {.#Some set!} set! @@ -290,18 +303,18 @@ (static runtime.variant_value_field) (|> value - (array.read! 2) + (array.item 2) maybe.trusted js_object (ffi.is java/lang/Object)) _ - (panic! (exception.error ..unknown_member [(as Text member) (as java/lang/Object value)]))) - ) + (panic! (exception.error ..unknown_member [(as Text member) (as java/lang/Object value)])))) (org/openjdk/nashorn/api/scripting/AbstractJSObject - [] (getSlot self [idx int]) java/lang/Object + [] (getSlot self [idx int]) + java/lang/Object (|> value - (array.read! (|> idx java/lang/Integer::longValue (as Nat))) + (array.item (|> idx java/lang/Integer::longValue (as Nat))) maybe.trusted js_object (as java/lang/Object))) @@ -313,7 +326,7 @@ (exception.report (list ["Class" (ffi.of_string (java/lang/Object::toString (java/lang/Object::getClass object)))] ["Object" (ffi.of_string (java/lang/Object::toString object))] - ["Keys" (case (ffi.is org/openjdk/nashorn/api/scripting/ScriptObjectMirror object) + ["Keys" (case (ffi.as org/openjdk/nashorn/api/scripting/ScriptObjectMirror object) {.#Some object} (|> object (org/openjdk/nashorn/api/scripting/ScriptObjectMirror::getOwnKeys true) @@ -327,7 +340,7 @@ (-> Text org/openjdk/nashorn/api/scripting/ScriptObjectMirror (Maybe Int)) (|> i64 (org/openjdk/nashorn/api/scripting/JSObject::getMember [(ffi.as_string half)]) - (maybe#each (|>> (ffi.is java/lang/Number))) + (maybe#each (|>> (ffi.as java/lang/Number))) maybe#conjoint (maybe#each (|>> java/lang/Number::longValue ffi.of_long)))) @@ -353,7 +366,7 @@ (org/openjdk/nashorn/api/scripting/JSObject::getMember [(ffi.as_string runtime.variant_flag_field)] js_object) (org/openjdk/nashorn/api/scripting/JSObject::getMember [(ffi.as_string runtime.variant_value_field)] js_object)] (^.multi [{.#Some tag} ?flag {.#Some value}] - [[(ffi.is java/lang/Number tag) (lux_object value)] + [[(ffi.as java/lang/Number tag) (lux_object value)] [{.#Some tag} {try.#Success value}]]) {.#Some [(java/lang/Number::intValue (as java/lang/Number tag)) (maybe.else (ffi.null) ?flag) @@ -374,14 +387,14 @@ (if (n.< num_keys idx) (case (org/openjdk/nashorn/api/scripting/JSObject::getMember (ffi.as_string (%.nat idx)) js_object) {.#Some member} - (case (ffi.is org/openjdk/nashorn/internal/runtime/Undefined member) + (case (ffi.as org/openjdk/nashorn/internal/runtime/Undefined member) {.#Some _} (again (++ idx) output) {.#None} (case (lux_object member) {try.#Success parsed_member} - (again (++ idx) (array.write! idx (as java/lang/Object parsed_member) output)) + (again (++ idx) (array.has! idx (as java/lang/Object parsed_member) output)) {try.#Failure error} {.#None})) @@ -395,13 +408,13 @@ (-> java/lang/Object (Try Any)) (`` (<| (if (ffi.null? js_object) (exception.except ..null_has_no_lux_representation [{.#None}])) - (case (ffi.is org/openjdk/nashorn/internal/runtime/Undefined js_object) + (case (ffi.as org/openjdk/nashorn/internal/runtime/Undefined js_object) {.#Some _} (exception.except ..undefined_has_no_lux_representation []) {.#None}) (,, (with_template [<class>] - [(case (ffi.is <class> js_object) + [(case (ffi.as <class> js_object) {.#Some js_object} {try.#Success js_object} @@ -409,7 +422,7 @@ [java/lang/Boolean] [java/lang/String])) (,, (with_template [<class> <method>] - [(case (ffi.is <class> js_object) + [(case (ffi.as <class> js_object) {.#Some js_object} {try.#Success (<method> js_object)} @@ -418,7 +431,7 @@ [java/lang/Number java/lang/Number::doubleValue] [StructureValue StructureValue::getValue] [IntValue IntValue::getValue])) - (case (ffi.is org/openjdk/nashorn/api/scripting/ScriptObjectMirror js_object) + (case (ffi.as org/openjdk/nashorn/api/scripting/ScriptObjectMirror js_object) {.#Some js_object} (case (check_int js_object) {.#Some value} @@ -451,7 +464,7 @@ (do maybe.monad [function (|> function (as java/lang/Object) - (ffi.is org/openjdk/nashorn/api/scripting/JSObject))] + (ffi.as org/openjdk/nashorn/api/scripting/JSObject))] (if (ffi.of_boolean (org/openjdk/nashorn/api/scripting/JSObject::isFunction function)) {.#Some function} {.#None}))) @@ -469,8 +482,8 @@ (org/openjdk/nashorn/api/scripting/JSObject::call {.#None} (|> (array.empty 2) (is (Array java/lang/Object)) - (array.write! 0 (to_js inputs)) - (array.write! 1 (to_js lux))) + (array.has! 0 (to_js inputs)) + (array.has! 1 (to_js lux))) macro)))) (exception (cannot_apply_a_non_function [object java/lang/Object]) @@ -642,7 +655,7 @@ platform.#phase_wrapper ..phase_wrapper platform.#write (|>> _.code (at utf8.codec encoded))]))) -(def (program context program) +(def (lux_program context program) (Program _.Expression _.Statement) (let [@process (_.var "process") on_node_js? (|> @process @@ -681,11 +694,11 @@ output (org/openjdk/nashorn/api/scripting/JSObject::call {.#None} (|> (array.empty 5) (is (Array java/lang/Object)) - (array.write! 0 name) - (array.write! 1 (as java/lang/Object (extender phase))) - (array.write! 2 (to_js archive)) - (array.write! 3 (to_js parameters)) - (array.write! 4 (to_js state))) + (array.has! 0 name) + (array.has! 1 (as java/lang/Object (extender phase))) + (array.has! 2 (to_js archive)) + (array.has! 3 (to_js parameters)) + (array.has! 4 (to_js state))) handler)] (lux_object (as java/lang/Object output))))) @@ -696,7 +709,7 @@ (def (declare_success! _) (-> Any (Async Any)) - (async.future (at world/program.default exit +0))) + (async.future (at world/environment.default exit +0))) (def (scope body) (-> _.Statement _.Statement) @@ -720,7 +733,8 @@ (io.io platform) generation.bundle (function.constant extension/bundle.empty) - ..program + ..lux_program + (reference.constant js/reference.system) [(And Register Text) _.Expression _.Statement] ..extender service diff --git a/lux-jvm/commands.md b/lux-jvm/commands.md index 724083f8b..42b24ba39 100644 --- a/lux-jvm/commands.md +++ b/lux-jvm/commands.md @@ -22,17 +22,17 @@ cd ~/lux/lux-jvm/ && java -jar target/program.jar repl --source ~/lux/stdlib/sou # Try ``` -cd ~/lux/lux-jvm/ && time java -jar target/program.jar build --source ~/lux/stdlib/source --target ~/lux/stdlib/target --module test/lux +cd ~/lux/lux-jvm/ && time java -jar target/program.jar build --source ~/lux/stdlib/source --target ~/lux/stdlib/target --module test/lux --program _ cd ~/lux/lux-jvm/ && java -jar target/program.jar export --source ~/lux/stdlib/source --target ~/lux/stdlib/target cd ~/lux/stdlib/ \ && cd ~/lux/lux-jvm/ \ -&& time java -jar target/program.jar build --source ~/lux/stdlib/source --library ~/lux/stdlib/target/library.tar --target ~/lux/stdlib/target --module test/lux +&& time java -jar target/program.jar build --source ~/lux/stdlib/source --library ~/lux/stdlib/target/library.tar --target ~/lux/stdlib/target --module test/lux --program _ ## Use new JVM compiler to compile tests for the Standard Library cd ~/lux/stdlib/ \ && lein clean \ -&& java -jar ~/lux/lux-jvm/target/program.jar build --host_dependency ~/.m2/repository/com/github/luxlang/lux-jvm-function/0.6.5/lux-jvm-function-0.6.5.jar --source ~/lux/stdlib/source --target ~/lux/stdlib/target --module test/lux \ +&& java -jar ~/lux/lux-jvm/target/program.jar build --host_dependency ~/.m2/repository/com/github/luxlang/lux-jvm-function/0.6.5/lux-jvm-function-0.6.5.jar --source ~/lux/stdlib/source --target ~/lux/stdlib/target --module test/lux --program _ \ && java -jar ~/lux/stdlib/target/program.jar ``` diff --git a/lux-jvm/source/program.lux b/lux-jvm/source/program.lux index 17fe054ef..85b517bbd 100644 --- a/lux-jvm/source/program.lux +++ b/lux-jvm/source/program.lux @@ -169,19 +169,19 @@ (let [context (context.jvm (cli.target service))] (exec (do async.monad [[loader host platform] (async.future ..platform) - _ (compositor.compiler - ..lux_compiler - context - ..expander - (analysis.bundle loader host) - (io.io platform) - generation.bundle - (|>> ..extender (declaration.bundle loader)) - (/program.program /runtime.class_name) /reference.constant - [Anchor (type_literal (Bytecode Any)) Definition] - ..extender - service - [(packager.package context) - (format (cli.target service) (at file.default separator) "program.jar")])] + _ (compositor.compiler ..lux_compiler + context + ..expander + (analysis.bundle loader host) + (io.io platform) + generation.bundle + (|>> ..extender (declaration.bundle loader)) + (/program.program /runtime.class_name) + /reference.constant + [Anchor (type_literal (Bytecode Any)) Definition] + ..extender + service + [(packager.package context) + (format (cli.target service) (at file.default separator) "program.jar")])] (..declare_success! [])) (io.io []))))) diff --git a/lux-lua/commands.md b/lux-lua/commands.md index 6dd497307..6ffa0453e 100644 --- a/lux-lua/commands.md +++ b/lux-lua/commands.md @@ -20,7 +20,7 @@ cd ~/lux/lux-lua/ \ ## Compile Lux's Standard Library's tests using a JVM-based compiler. cd ~/lux/stdlib/ \ && lein clean \ -&& java -jar ~/lux/lux-lua/target/program.jar build --source ~/lux/stdlib/source --target ~/lux/stdlib/target --module test/lux \ +&& java -jar ~/lux/lux-lua/target/program.jar build --source ~/lux/stdlib/source --target ~/lux/stdlib/target --module test/lux --program _ \ && ~/lua-5.4.2/install/bin/lua ~/lux/stdlib/target/program.lua ``` diff --git a/lux-lua/project.lux b/lux-lua/project.lux index 1e54cef63..b92be693a 100644 --- a/lux-lua/project.lux +++ b/lux-lua/project.lux @@ -29,5 +29,5 @@ ["com.github.luxlang" "rembulan-stdlib" "0.1" "jar"] ["com.github.luxlang" "rembulan-compiler" "0.1" "jar"]] - "program" "program" + "program" program._ "configuration" ["lua_compiler?" ""]]] diff --git a/lux-lua/source/program.lux b/lux-lua/source/program.lux index 150feec52..e1de9fdb0 100644 --- a/lux-lua/source/program.lux +++ b/lux-lua/source/program.lux @@ -27,10 +27,10 @@ ["[0]" i64]]] [meta ["[0]" static] + ["[0]" code] [macro ["^" pattern] - ["[0]" local] - ["[0]" code]] + ["[0]" local]] ["@" target (.only) ["_" lua]] ["[0]" compiler @@ -53,7 +53,8 @@ [generation ["[0]" reference] ["[0]" lua (.only) - ["[0]" runtime]]]]]] + ["[0]" runtime] + ["[1]/[0]" reference]]]]]] [default ["[0]" platform (.only Platform)]] [meta @@ -64,7 +65,7 @@ ["[1]" script]]]]] ["[0]" world ["[0]" file] - ["[1]/[0]" program]]]] + ["[1]/[0]" environment]]]] [program ["/" compositor]]) @@ -866,7 +867,7 @@ platform.#phase_wrapper ..phase_wrapper platform.#write (|>> _.code (at utf8.codec encoded))]))))) -(def (program context program) +(def (lux_program context program) (Program _.Expression _.Statement) (let [$program (_.var (reference.artifact context))] (_.statement (_.apply (list (runtime.lux//program_args (_.var "arg")) @@ -875,7 +876,7 @@ (def (declare_success! _) (-> Any (Async Any)) - (async.future (at world/program.default exit +0))) + (async.future (at world/environment.default exit +0))) (def (lux_compiler it) (-> Any platform.Custom) @@ -899,7 +900,8 @@ (io.io platform) generation.bundle (function.constant extension/bundle.empty) - ..program + ..lux_program + (reference.constant lua/reference.system) [(type_literal [Register _.Label]) _.Expression _.Statement] diff --git a/lux-mode/lux-mode.el b/lux-mode/lux-mode.el index 1d6637087..ca2a16a83 100644 --- a/lux-mode/lux-mode.el +++ b/lux-mode/lux-mode.el @@ -386,8 +386,8 @@ Called by `imenu--generic-function'." ;; Code (code//quotation (altRE "`" "`'" "'" "," ",\\*" ",'")) (code//super-quotation (altRE "``" ",,")) - (code//template (altRE "with_template" "template")) - (code//macro (altRE "macro" "syntax")) + (code//template (altRE "with_template")) + (code//macro (altRE "macro" "template" "syntax")) ;; Miscellaneous (jvm-host (altRE "import" "export" "class" "interface" "object" "synchronized" "class_for")) (alternative-format (altRE "char" "bin" "oct" "hex")) @@ -399,7 +399,8 @@ Called by `imenu--generic-function'." (extension (altRE "analysis" "synthesis" "generation" "declaration")) (definition (altRE "\\.require" "def" "inlined" "type" - "exception"))) + "exception" + "vocabulary"))) (let ((control (altRE control//flow control//pattern-matching control//logic diff --git a/lux-python/commands.md b/lux-python/commands.md index 869413fa7..c49f375f1 100644 --- a/lux-python/commands.md +++ b/lux-python/commands.md @@ -20,7 +20,7 @@ cd ~/lux/lux-python/ \ ## Compile Lux's Standard Library's tests using a JVM-based compiler. cd ~/lux/stdlib/ \ && lux clean \ -&& java -jar ~/lux/lux-python/target/program.jar build --source ~/lux/stdlib/source --target ~/lux/stdlib/target --module test/lux \ +&& java -jar ~/lux/lux-python/target/program.jar build --source ~/lux/stdlib/source --target ~/lux/stdlib/target --module test/lux --program _ \ && python3 ~/lux/stdlib/target/program.py ``` diff --git a/lux-python/project.lux b/lux-python/project.lux index b9b95ff62..be674f0dc 100644 --- a/lux-python/project.lux +++ b/lux-python/project.lux @@ -21,4 +21,4 @@ ["org.python" "jython-standalone" "2.7.2" "jar"]] - "program" "program"]] + "program" program._]] diff --git a/lux-python/source/program.lux b/lux-python/source/program.lux index cf4398f89..8cbe4e0e4 100644 --- a/lux-python/source/program.lux +++ b/lux-python/source/program.lux @@ -29,10 +29,10 @@ ["[0]" i64]]] [meta ["[0]" static] + ["[0]" code] [macro ["^" pattern] - ["[0]" template] - ["[0]" code]] + ["[0]" template]] ["@" target (.only) ["_" python]] ["[0]" compiler @@ -56,7 +56,8 @@ [generation ["[0]" reference] ["[0]" python (.only) - ["[0]" runtime]]]]]] + ["[0]" runtime] + ["[1]/[0]" reference]]]]]] [default ["[0]" platform (.only Platform)]] [meta @@ -68,7 +69,7 @@ ["[1]" script]]]]] ["[0]" world ["[0]" file] - ["[1]/[0]" program]]]] + ["[1]/[0]" environment]]]] [program ["/" compositor]]) @@ -538,7 +539,7 @@ platform.#phase_wrapper ..phase_wrapper platform.#write (|>> _.code (at utf8.codec encoded))]))) -(def (program context program) +(def (lux_program context program) (Program (_.Expression Any) (_.Statement Any)) (all _.then (_.import "sys") @@ -553,7 +554,7 @@ (def (declare_success! _) (-> Any (Async Any)) - (async.future (at world/program.default exit +0))) + (async.future (at world/environment.default exit +0))) (def (scope body) (-> (_.Statement Any) (_.Statement Any)) @@ -588,7 +589,8 @@ ..platform generation.bundle (function.constant extension/bundle.empty) - ..program + ..lux_program + (reference.constant python/reference.system) [Register (type_literal (_.Expression Any)) (type_literal (_.Statement Any))] diff --git a/lux-ruby/commands.md b/lux-ruby/commands.md index 0546f063f..3ec117745 100644 --- a/lux-ruby/commands.md +++ b/lux-ruby/commands.md @@ -20,7 +20,7 @@ cd ~/lux/lux-ruby/ \ ## Compile Lux's Standard Library's tests using a JVM-based compiler. cd ~/lux/stdlib/ \ && lein clean \ -&& java -jar ~/lux/lux-ruby/target/program.jar build --source ~/lux/stdlib/source --target ~/lux/stdlib/target --module test/lux \ +&& java -jar ~/lux/lux-ruby/target/program.jar build --source ~/lux/stdlib/source --target ~/lux/stdlib/target --module test/lux --program _ \ && RUBY_THREAD_VM_STACK_SIZE=15700000 ruby ~/lux/stdlib/target/program/main.rb ``` diff --git a/lux-ruby/project.lux b/lux-ruby/project.lux index e23b606b2..8d759a09b 100644 --- a/lux-ruby/project.lux +++ b/lux-ruby/project.lux @@ -1,5 +1,5 @@ ["" - ["identity" ["com.github.luxlang" "lux-ruby" "0.6.6-SNAPSHOT"] + ["identity" ["com.github.luxlang" "lux-ruby" "0.7.0-SNAPSHOT"] "description" "A Ruby compiler for Lux." "info" ["url" "https://github.com/LuxLang/lux" "scm" "https://github.com/LuxLang/lux.git" @@ -21,4 +21,4 @@ ["org.jruby" "jruby-complete" "9.2.15.0" "jar"]] - "program" "program"]] + "program" program._]] diff --git a/lux-ruby/source/program.lux b/lux-ruby/source/program.lux index df8ed9b66..324d4cefc 100644 --- a/lux-ruby/source/program.lux +++ b/lux-ruby/source/program.lux @@ -22,20 +22,17 @@ [collection ["[0]" array (.only Array)] ["[0]" list (.use "[1]#[0]" functor)]]] - [macro - ["^" pattern] - ["[0]" template]] [math [number (.only hex) ["n" nat] ["i" int] ["[0]" i64]]] - ["[0]" world - ["[0]" file] - ["[1]/[0]" program]] - ["@" target (.only) - ["_" ruby]] [meta + ["@" target (.only) + ["_" ruby]] + [macro + ["^" pattern] + ["[0]" template]] ["[0]" compiler ["[0]" phase (.only Operation Phase) (.use "[1]#[0]" monad)] [reference @@ -57,7 +54,8 @@ [generation ["[0]" reference] ["[0]" ruby (.only) - ["[0]" runtime]]]]]] + ["[0]" runtime] + ["[1]/[0]" reference]]]]]] [default ["[0]" platform (.only Platform)]] [meta @@ -65,7 +63,10 @@ ["[0]" context] ["[0]" cli] ["[0]" packager - ["[1]" ruby]]]]]]] + ["[1]" ruby]]]]] + ["[0]" world + ["[0]" file] + ["[1]/[0]" environment]]]] [program ["/" compositor]]) @@ -966,7 +967,7 @@ platform.#phase_wrapper ..phase_wrapper platform.#write (|>> _.code (at utf8.codec encoded))]))) -(def (program context program) +(def (lux_program context program) (Program _.Expression _.Statement) (let [normal_runtime? (_.do "const_defined?" (list (_.string (_.code _.command_line_arguments))) @@ -981,7 +982,7 @@ (def (declare_success! _) (-> Any (Async Any)) - (async.future (at world/program.default exit +0))) + (async.future (at world/environment.default exit +0))) (def (lux_compiler it) (-> Any platform.Custom) @@ -998,7 +999,8 @@ ..platform generation.bundle (function.constant extension/bundle.empty) - ..program + ..lux_program + (reference.constant ruby/reference.system) [Register _.Expression _.Statement] ..extender service diff --git a/stdlib/commands.md b/stdlib/commands.md index 874ee070a..0dbd64e87 100644 --- a/stdlib/commands.md +++ b/stdlib/commands.md @@ -92,7 +92,7 @@ cd ~/lux/stdlib/ \ cd ~/lux/stdlib/ \ && lux clean \ && lux with ruby with scriptum build \ -&& RUBY_THREAD_VM_STACK_SIZE=15700000 ruby ~/lux/stdlib/target/program.rb | tee ~/lux/documentation/library/standard/ruby.md +&& RUBY_THREAD_VM_STACK_SIZE=15700000 ruby ~/lux/stdlib/target/program/main.rb | tee ~/lux/documentation/library/standard/ruby.md ``` --- diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux index 947fec8a1..1ffc31a13 100644 --- a/stdlib/source/documentation/lux.lux +++ b/stdlib/source/documentation/lux.lux @@ -893,6 +893,6 @@ /test.documentation /world.documentation]))) -(def _ +(.def _ (program inputs (io.io (debug.log! ($.markdown ..documentation))))) diff --git a/stdlib/source/documentation/lux/ffi.js.lux b/stdlib/source/documentation/lux/ffi.js.lux index cc4a6a8b2..a0e8edaef 100644 --- a/stdlib/source/documentation/lux/ffi.js.lux +++ b/stdlib/source/documentation/lux/ffi.js.lux @@ -54,14 +54,14 @@ [(= "function" (type_of (function (_ value) value)))]) - ($.definition /.constant + ($.definition /.global "Allows using definitions from the JavaScript host platform." - [(constant .Frac [Math PI])]) + [(global .Frac [Math PI])]) - ($.definition /.closure + ($.definition /.function (format "Allows defining closures/anonymous-functions in the form that JavaScript expects." \n "This is useful for adapting Lux functions for usage by JavaScript code.") [(is /.Function - (closure [left right] - (do_something (as Foo left) (as Bar right))))])] + (function [left right] + (do_something (as Foo left) (as Bar right))))])] [])) diff --git a/stdlib/source/documentation/lux/ffi.py.lux b/stdlib/source/documentation/lux/ffi.py.lux index 2701c47a1..d2da39eff 100644 --- a/stdlib/source/documentation/lux/ffi.py.lux +++ b/stdlib/source/documentation/lux/ffi.py.lux @@ -45,11 +45,11 @@ ("static" getsize [String] "io" "try" Integer) ("static" getmtime [String] "io" "try" Float))]) - ($.definition /.lambda + ($.definition /.function (format "Allows defining closures/anonymous-functions in the form that Python expects." \n "This is useful for adapting Lux functions for usage by Python code.") [(is ..Function - (lambda [left right] - (do_something (as Foo left) - (as Bar right))))])] + (function [left right] + (do_something (as Foo left) + (as Bar right))))])] [])) diff --git a/stdlib/source/documentation/lux/meta/macro.lux b/stdlib/source/documentation/lux/meta/macro.lux index 6e2557f3f..204efdd8c 100644 --- a/stdlib/source/documentation/lux/meta/macro.lux +++ b/stdlib/source/documentation/lux/meta/macro.lux @@ -18,19 +18,19 @@ (.List $.Module) ($.module /._ "" - [($.definition /.single_expansion - (format "Given code that requires applying a macro, does it once and returns the result." - \n "Otherwise, returns the code as-is.") - [(single_expansion syntax)]) + [... ($.definition /.single_expansion + ... (format "Given code that requires applying a macro, does it once and returns the result." + ... \n "Otherwise, returns the code as-is.") + ... [(single_expansion syntax)]) - ($.definition /.expansion - (format "Given code that requires applying a macro, expands repeatedly until no more direct macro-calls are left." - \n "Otherwise, returns the code as-is.") - [(expansion syntax)]) + ... ($.definition /.expansion + ... (format "Given code that requires applying a macro, expands repeatedly until no more direct macro-calls are left." + ... \n "Otherwise, returns the code as-is.") + ... [(expansion syntax)]) - ($.definition /.full_expansion - "Expands all macro-calls everywhere recursively, until only primitive/base code remains." - [(full_expansion syntax)]) + ... ($.definition /.full_expansion + ... "Expands all macro-calls everywhere recursively, until only primitive/base code remains." + ... [(full_expansion syntax)]) ($.definition /.symbol (format "Generates a unique name as a Code node (ready to be used in code templates)." @@ -52,48 +52,49 @@ (, g!_) ("jvm monitorexit" (, g!lock))] (, g!body))))))))]) - ($.definition /.one_expansion - "Works just like expand, except that it ensures that the output is a single Code token." - [(one_expansion token)]) + ... ($.definition /.one_expansion + ... "Works just like expand, except that it ensures that the output is a single Code token." + ... [(one_expansion token)]) - ($.definition /.log_single_expansion! - (format "Performs a macro-expansion and logs the resulting code." - \n "You can either use the resulting code, or omit them." - \n "By omitting them, this macro produces nothing (just like the lux.comment macro).") - [(log_single_expansion! - (def (foo bar baz) - (-> Int Int Int) - (int.+ bar baz))) - (log_single_expansion! "omit" - (def (foo bar baz) - (-> Int Int Int) - (int.+ bar baz)))]) + ... ($.definition /.log_single_expansion! + ... (format "Performs a macro-expansion and logs the resulting code." + ... \n "You can either use the resulting code, or omit them." + ... \n "By omitting them, this macro produces nothing (just like the lux.comment macro).") + ... [(log_single_expansion! + ... (def (foo bar baz) + ... (-> Int Int Int) + ... (int.+ bar baz))) + ... (log_single_expansion! "omit" + ... (def (foo bar baz) + ... (-> Int Int Int) + ... (int.+ bar baz)))]) - ($.definition /.log_expansion! - (format "Performs a macro-expansion and logs the resulting code." - \n "You can either use the resulting code, or omit them." - \n "By omitting them, this macro produces nothing (just like the lux.comment macro).") - [(log_expansion! - (def (foo bar baz) - (-> Int Int Int) - (int.+ bar baz))) - (log_expansion! "omit" - (def (foo bar baz) - (-> Int Int Int) - (int.+ bar baz)))]) + ... ($.definition /.log_expansion! + ... (format "Performs a macro-expansion and logs the resulting code." + ... \n "You can either use the resulting code, or omit them." + ... \n "By omitting them, this macro produces nothing (just like the lux.comment macro).") + ... [(log_expansion! + ... (def (foo bar baz) + ... (-> Int Int Int) + ... (int.+ bar baz))) + ... (log_expansion! "omit" + ... (def (foo bar baz) + ... (-> Int Int Int) + ... (int.+ bar baz)))]) - ($.definition /.log_full_expansion! - (format "Performs a macro-expansion and logs the resulting code." - \n "You can either use the resulting code, or omit them." - \n "By omitting them, this macro produces nothing (just like the lux.comment macro).") - [(log_full_expansion! - (def (foo bar baz) - (-> Int Int Int) - (int.+ bar baz))) - (log_full_expansion! "omit" - (def (foo bar baz) - (-> Int Int Int) - (int.+ bar baz)))])] + ... ($.definition /.log_full_expansion! + ... (format "Performs a macro-expansion and logs the resulting code." + ... \n "You can either use the resulting code, or omit them." + ... \n "By omitting them, this macro produces nothing (just like the lux.comment macro).") + ... [(log_full_expansion! + ... (def (foo bar baz) + ... (-> Int Int Int) + ... (int.+ bar baz))) + ... (log_full_expansion! "omit" + ... (def (foo bar baz) + ... (-> Int Int Int) + ... (int.+ bar baz)))]) + ] [/local.documentation /syntax.documentation /template.documentation])) diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index fa0108157..be2a9eb33 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -4884,62 +4884,61 @@ {#None} (failure (..wrong_syntax_error (symbol ..loop))))))) -(def (with_expansions' label tokens target) - (-> Text (List Code) Code (List Code)) - (case target - (pattern#or [_ {#Bit _}] - [_ {#Nat _}] - [_ {#Int _}] - [_ {#Rev _}] - [_ {#Frac _}] - [_ {#Text _}]) - (list target) - - [_ {#Symbol [module name]}] - (if (and (text#= "" module) - (text#= label name)) - tokens - (list target)) - - (with_template#pattern [<tag>] - [[location {<tag> elems}] - (list [location {<tag> (list#conjoint (list#each (with_expansions' label tokens) elems))}])]) - ([#Form] - [#Variant] - [#Tuple]))) - (def .public with_expansions - (macro (_ tokens) - (case (parsed (andP (tupleP (someP bindingP)) (someP anyP)) tokens) - {#Some [bindings bodies]} - (loop (again [bindings bindings - map (is (Property_List (List Code)) - (list))]) - (let [normal (is (-> Code (List Code)) - (function (_ it) - (list#mix (function (_ [binding expansion] it) - (list#conjoint (list#each (with_expansions' binding expansion) it))) - (list it) - map)))] - (case bindings - {#Item [var_name expr] &rest} - (do meta#monad - [expansion (case (normal expr) - (list expr) - (single_expansion expr) + (let [with_expansions' (is (-> Text (List Code) Code (List Code)) + (function (with_expansions' label tokens target) + (case target + (pattern#or [_ {#Bit _}] + [_ {#Nat _}] + [_ {#Int _}] + [_ {#Rev _}] + [_ {#Frac _}] + [_ {#Text _}]) + (list target) + + [_ {#Symbol [module name]}] + (if (and (text#= "" module) + (text#= label name)) + tokens + (list target)) + + (with_template#pattern [<tag>] + [[location {<tag> elems}] + (list [location {<tag> (list#conjoint (list#each (with_expansions' label tokens) elems))}])]) + ([#Form] + [#Variant] + [#Tuple]))))] + (macro (_ tokens) + (case (parsed (andP (tupleP (someP bindingP)) (someP anyP)) tokens) + {#Some [bindings bodies]} + (loop (again [bindings bindings + map (is (Property_List (List Code)) + (list))]) + (let [normal (is (-> Code (List Code)) + (function (_ it) + (list#mix (function (_ [binding expansion] it) + (list#conjoint (list#each (with_expansions' binding expansion) it))) + (list it) + map)))] + (case bindings + {#Item [var_name expr] &rest} + (do meta#monad + [expansion (case (normal expr) + (list expr) + (single_expansion expr) - _ - (failure (all text#composite - "Incorrect expansion in with_expansions" - " | Binding: " (text#encoded var_name) - " | Expression: " (code#encoded expr))))] - (again &rest (property#with var_name expansion map))) - - {#End} - (at meta#monad #in (list#conjoint (list#each normal bodies)))))) - - {#None} - (failure (..wrong_syntax_error (symbol ..with_expansions)))))) + _ + (failure (all text#composite + "Incorrect expansion in with_expansions" + " | Binding: " (text#encoded var_name) + " | Expression: " (code#encoded expr))))] + (again &rest (property#with var_name expansion map))) + + {#End} + (at meta#monad #in (list#conjoint (list#each normal bodies)))))) + + {#None} + (failure (..wrong_syntax_error (symbol ..with_expansions))))))) (def (flat_alias type) (-> Type Type) @@ -4960,136 +4959,58 @@ _ type)) -(def (static_simple_literal name) - (-> Symbol (Meta Code)) - (do meta#monad - [type+value (definition_value name) - .let [[type value] type+value]] - (case (flat_alias type) - (with_template#pattern [<name> <type> <wrapper>] - [{#Named ["library/lux" <name>] _} - (in (<wrapper> (as <type> value)))]) - (["Bit" Bit bit$] - ["Nat" Nat nat$] - ["Int" Int int$] - ["Rev" Rev rev$] - ["Frac" Frac frac$] - ["Text" Text text$]) - - _ - (failure (text#composite "Cannot anti-quote type: " (symbol#encoded name)))))) - -(def (static_literal token) - (-> Code (Meta Code)) - (case token - [_ {#Symbol [def_module def_name]}] - (if (text#= "" def_module) - (do meta#monad - [current_module current_module_name] - (static_simple_literal [current_module def_name])) - (static_simple_literal [def_module def_name])) - - (with_template#pattern [<tag>] - [[meta {<tag> parts}] - (do meta#monad - [=parts (monad#each meta#monad static_literal parts)] - (in [meta {<tag> =parts}]))]) - ([#Form] - [#Variant] - [#Tuple]) - - _ - (meta#in token) - ... TODO: Figure out why this doesn't work: - ... (at meta#monad in token) - )) - (def .public static - (macro (_ tokens) - (case tokens - (list pattern) - (do meta#monad - [pattern' (static_literal pattern)] - (in (list pattern'))) - - _ - (failure (..wrong_syntax_error (symbol ..static)))))) - -(type Multi_Level_Case - [Code (List [Code Code])]) - -(def (case_level^ level) - (-> Code (Meta [Code Code])) - (meta#in (case level - [_ {#Tuple (list expr binding)}] - [expr binding] - - _ - [level (` #1)]))) - -(def (multi_level_case^ levels) - (-> (List Code) (Meta Multi_Level_Case)) - (case levels - {#End} - (failure "Multi-level patterns cannot be empty.") - - {#Item init extras} - (do meta#monad - [extras' (monad#each meta#monad case_level^ extras)] - (in [init extras'])))) - -(def (multi_level_case$ g!_ [[init_pattern levels] body]) - (-> Code [Multi_Level_Case Code] (List Code)) - (let [inner_pattern_body (list#mix (function (_ [calculation pattern] success) - (let [bind? (case pattern - [_ {#Symbol _}] - #1 - - _ - #0)] - (` (case (, calculation) - (, pattern) - (, success) - - (,* (if bind? - (list) - (list g!_ (` {.#None})))))))) - (` {.#Some (, body)}) - (is (List [Code Code]) (list#reversed levels)))] - (list init_pattern inner_pattern_body))) - -(def pattern#multi - (pattern - (macro (_ tokens) - (case tokens - (list#partial [_meta {#Form levels}] body next_branches) - (do meta#monad - [mlc (multi_level_case^ levels) - .let [initial_bind? (case mlc - [[_ {#Symbol _}] _] - #1 + (let [simple_literal (is (-> Symbol (Meta Code)) + (function (simple_literal name) + (do meta#monad + [type+value (definition_value name) + .let [[type value] type+value]] + (case (flat_alias type) + (with_template#pattern [<name> <type> <wrapper>] + [{#Named ["library/lux" <name>] _} + (in (<wrapper> (as <type> value)))]) + (["Bit" Bit bit$] + ["Nat" Nat nat$] + ["Int" Int int$] + ["Rev" Rev rev$] + ["Frac" Frac frac$] + ["Text" Text text$]) + + _ + (failure (text#composite "Cannot anti-quote type: " (symbol#encoded name))))))) + literal (is (-> Code (Meta Code)) + (function (literal token) + (case token + [_ {#Symbol [def_module def_name]}] + (if (text#= "" def_module) + (do meta#monad + [current_module current_module_name] + (simple_literal [current_module def_name])) + (simple_literal [def_module def_name])) - _ - #0)] - expected ..expected_type - g!temp (..generated_symbol "temp")] - (in (list g!temp - (` ({{.#Some (, g!temp)} - (, g!temp) - - {.#None} - (case (, g!temp) - (,* next_branches))} - ("lux type check" {.#Apply (, (type_code expected)) Maybe} - (case (, g!temp) - (,* (multi_level_case$ g!temp [mlc body])) - - (,* (if initial_bind? - (list) - (list g!temp (` {.#None}))))))))))) - - _ - (failure (..wrong_syntax_error (symbol ..pattern#multi))))))) + (with_template#pattern [<tag>] + [[meta {<tag> parts}] + (do meta#monad + [=parts (monad#each meta#monad literal parts)] + (in [meta {<tag> =parts}]))]) + ([#Form] + [#Variant] + [#Tuple]) + + _ + (meta#in token) + ... TODO: Figure out why this doesn't work: + ... (at meta#monad in token) + )))] + (macro (_ tokens) + (case tokens + (list pattern) + (do meta#monad + [pattern' (literal pattern)] + (in (list pattern'))) + + _ + (failure (..wrong_syntax_error (symbol ..static))))))) (def .public (same? reference sample) (All (_ a) @@ -5107,24 +5028,22 @@ _ (failure (..wrong_syntax_error (symbol ..as_expected)))))) -(def location - (Meta Location) - (function (_ compiler) - {#Right [compiler (the #location compiler)]})) - (def .public undefined - (macro (_ tokens) - (case tokens - {#End} - (do meta#monad - [location ..location - .let [[module line column] location - location (all "lux text concat" (text#encoded module) "," (nat#encoded line) "," (nat#encoded column)) - message (all "lux text concat" "Undefined behavior @ " location)]] - (in (list (` (..panic! (, (text$ message))))))) - - _ - (failure (..wrong_syntax_error (symbol ..undefined)))))) + (let [location (is (Meta Location) + (function (_ compiler) + {#Right [compiler (the #location compiler)]}))] + (macro (_ tokens) + (case tokens + {#End} + (do meta#monad + [location location + .let [[module line column] location + location (all "lux text concat" (text#encoded module) "," (nat#encoded line) "," (nat#encoded column)) + message (all "lux text concat" "Undefined behavior @ " location)]] + (in (list (` (..panic! (, (text$ message))))))) + + _ + (failure (..wrong_syntax_error (symbol ..undefined))))))) (def .public type_of (macro (_ tokens) @@ -5143,42 +5062,43 @@ _ (failure (..wrong_syntax_error (symbol ..type_of)))))) -(def (templateP tokens) - (-> (List Code) (Maybe [Text (List Text) (List Code)])) - (do maybe#monad - [% (local_declarationP tokens) - .let' [[tokens [name parameters]] %] - % (tupleP (someP anyP) tokens) - .let' [[tokens templates] %] - _ (endP tokens)] - (in [name parameters templates]))) - (def .public template - (macro (_ tokens) - (case (templateP tokens) - {#Some [name args input_templates]} - (do meta#monad - [g!tokens (..generated_symbol "tokens") - g!compiler (..generated_symbol "compiler") - g!_ (..generated_symbol "_") - .let [rep_env (list#each (function (_ arg) - [arg (` ((,' ,) (, (local$ arg))))]) - args)] - this_module current_module_name] - (in (list (` (..macro ((, (local$ name)) (, g!tokens) (, g!compiler)) - (case (, g!tokens) - (list (,* (list#each local$ args))) - {.#Right [(, g!compiler) - (list (,* (list#each (function (_ template) - (` (`' (, (with_replacements rep_env - template))))) - input_templates)))]} - - (, g!_) - {.#Left "Invalid syntax."})))))) + (let [templateP (is (-> (List Code) (Maybe [Text (List Text) (List Code)])) + (function (_ tokens) + (do maybe#monad + [% (local_declarationP tokens) + .let' [[tokens [name parameters]] %] + % (tupleP (someP anyP) tokens) + .let' [[tokens templates] %] + _ (endP tokens)] + (in [name parameters templates])))) + simple_replacement_environment (is (-> (List Text) Replacement_Environment) + (list#each (function (_ arg) + [arg (` ((,' ,) (, (local$ arg))))]))) + instantiated_template (is (-> Replacement_Environment Code Code) + (function (_ replacement_environment template) + (` (`' (, (with_replacements replacement_environment + template))))))] + (macro (_ tokens) + (case (templateP tokens) + {#Some [name args input_templates]} + (do meta#monad + [g!tokens (..generated_symbol "tokens") + g!compiler (..generated_symbol "compiler") + g!_ (..generated_symbol "_") + this_module ..current_module_name] + (in (list (` (..macro ((, (local$ name)) (, g!tokens) (, g!compiler)) + (case (, g!tokens) + (list (,* (list#each local$ args))) + {.#Right [(, g!compiler) + (list (,* (list#each (instantiated_template (simple_replacement_environment args)) + input_templates)))]} + + (, g!_) + {.#Left "Invalid syntax."})))))) - {#None} - (failure (..wrong_syntax_error (symbol ..template)))))) + {#None} + (failure (..wrong_syntax_error (symbol ..template))))))) (with_template [<name> <to>] [(def .public <name> @@ -5198,76 +5118,73 @@ (def .public char (macro (_ tokens compiler) (case tokens - (pattern#multi (list [_ {#Text input}]) - (|> input "lux text size" ("lux i64 =" 1))) - (|> input ("lux text char" 0) - nat$ list - [compiler] {#Right}) + (list [_ {#Text input}]) + (if (|> input "lux text size" ("lux i64 =" 1)) + (|> input ("lux text char" 0) + nat$ list + [compiler] {#Right}) + {#Left (..wrong_syntax_error (symbol ..char))}) _ {#Left (..wrong_syntax_error (symbol ..char))}))) -(def target - (Meta Text) - (function (_ compiler) - {#Right [compiler (the [#info #target] compiler)]})) - -(def (platform_name choice) - (-> Code (Meta Text)) - (case choice - [_ {#Text platform}] - (..meta#in platform) - - [_ {#Symbol symbol}] - (do meta#monad - [symbol (..global_symbol symbol) - type+value (..definition_value symbol) - .let [[type value] type+value]] - (case (..flat_alias type) - (pattern#or {#Primitive "#Text" {#End}} - {#Named ["library/lux" "Text"] {#Primitive "#Text" {#End}}}) - (in (as ..Text value)) - - _ - (failure (all text#composite - "Invalid target platform (must be a value of type Text): " (symbol#encoded symbol) - " : " (..code#encoded (..type_code type)))))) - - _ - (failure (all text#composite - "Invalid target platform syntax: " (..code#encoded choice) - \n "Must be either a text literal or a symbol.")))) - -(def (target_pick target options default) - (-> Text (List [Code Code]) (Maybe Code) (Meta (List Code))) - (case options - {#End} - (case default - {#None} - (failure (all text#composite "No code for target platform: " target)) - - {#Some default} - (meta#in (list default))) - - {#Item [key pick] options'} - (do meta#monad - [platform (..platform_name key)] - (if (text#= target platform) - (meta#in (list pick)) - (target_pick target options' default))))) - (def .public for - (macro (_ tokens) - (case (..parsed (..andP (..someP (..andP ..anyP ..anyP)) - (..maybeP ..anyP)) - tokens) - {.#Some [options default]} - (do meta#monad - [target ..target] - (target_pick target options default)) + (let [target (is (Meta Text) + (function (_ compiler) + {#Right [compiler (the [#info #target] compiler)]})) + platform_name (is (-> Code (Meta Text)) + (function (_ choice) + (case choice + [_ {#Text platform}] + (..meta#in platform) + + [_ {#Symbol symbol}] + (do meta#monad + [symbol (..global_symbol symbol) + type+value (..definition_value symbol) + .let [[type value] type+value]] + (case (..flat_alias type) + (pattern#or {#Primitive "#Text" {#End}} + {#Named ["library/lux" "Text"] {#Primitive "#Text" {#End}}}) + (in (as ..Text value)) - {.#None} - (failure (..wrong_syntax_error (symbol ..for)))))) + _ + (failure (all text#composite + "Invalid target platform (must be a value of type Text): " (symbol#encoded symbol) + " : " (..code#encoded (..type_code type)))))) + + _ + (failure (all text#composite + "Invalid target platform syntax: " (..code#encoded choice) + \n "Must be either a text literal or a symbol."))))) + target_pick (is (-> Text (List [Code Code]) (Maybe Code) (Meta (List Code))) + (function (target_pick target options default) + (case options + {#End} + (case default + {#None} + (failure (all text#composite "No code for target platform: " target)) + + {#Some default} + (meta#in (list default))) + + {#Item [key pick] options'} + (do meta#monad + [platform (platform_name key)] + (if (text#= target platform) + (meta#in (list pick)) + (target_pick target options' default))))))] + (macro (_ tokens) + (case (..parsed (..andP (..someP (..andP ..anyP ..anyP)) + (..maybeP ..anyP)) + tokens) + {.#Some [options default]} + (do meta#monad + [target target] + (target_pick target options default)) + + {.#None} + (failure (..wrong_syntax_error (symbol ..for))))))) ... TODO: Delete "scope_type_vars" (including the #scope_type_vars Lux state) and "parameter" ASAP. (for "{old}" (these (def (scope_type_vars state) @@ -5296,40 +5213,39 @@ (failure (..wrong_syntax_error (symbol ..$))))))) (these (def .public parameter ""))) -(def (refer_code imported_module alias referrals) - (-> Text Text (List Referral) Code) - (` (..refer (, (text$ imported_module)) - (, (text$ alias)) - (,* (list#each (function (_ [macro parameters]) - (` ((, (symbol$ macro)) (,* parameters)))) - referrals))))) - (def .public require - (macro (_ _imports) - (do meta#monad - [current_module ..current_module_name - imports (imports_parser #0 current_module {#End} _imports) - .let [=imports (|> imports - (list#each (is (-> Importation Code) - (function (_ [module_name m_alias =refer]) - (` [(, (text$ module_name)) (, (text$ (..maybe#else "" m_alias)))])))) - tuple$) - =refers (list#each (is (-> Importation Code) - (function (_ [module_name m_alias =refer]) - (refer_code module_name (..maybe#else "" m_alias) =refer))) - imports) - =module (` ("lux def module" (, =imports)))] - g!_ (..generated_symbol "")] - (in {#Item =module - (for "Python" - ... TODO: Remove this hack once Jython is no longer being used as the Python interpreter. - ... Without it, I get this strange error - ... {library/lux/tool/compiler/language/lux/generation.no_buffer_for_saving_code} - ... Artifact ID: 0 - ... Which only ever happens for the Python compiler. - (list#partial (` ("lux def" (, g!_) [] #0)) - =refers) - =refers)})))) + (let [refer_code (is (-> Text Text (List Referral) Code) + (function (_ imported_module alias referrals) + (` (..refer (, (text$ imported_module)) + (, (text$ alias)) + (,* (list#each (function (_ [macro parameters]) + (` ((, (symbol$ macro)) (,* parameters)))) + referrals))))))] + (macro (_ _imports) + (do meta#monad + [current_module ..current_module_name + imports (imports_parser #0 current_module {#End} _imports) + .let [=imports (|> imports + (list#each (is (-> Importation Code) + (function (_ [module_name m_alias =refer]) + (` [(, (text$ module_name)) (, (text$ (..maybe#else "" m_alias)))])))) + tuple$) + =refers (list#each (is (-> Importation Code) + (function (_ [module_name m_alias =refer]) + (refer_code module_name (..maybe#else "" m_alias) =refer))) + imports) + =module (` ("lux def module" (, =imports)))] + g!_ (..generated_symbol "")] + (in {#Item =module + (for "Python" + ... TODO: Remove this hack once Jython is no longer being used as the Python interpreter. + ... Without it, I get this strange error + ... {library/lux/tool/compiler/language/lux/generation.no_buffer_for_saving_code} + ... Artifact ID: 0 + ... Which only ever happens for the Python compiler. + (list#partial (` ("lux def" (, g!_) [] #0)) + =refers) + =refers)}))))) (type .public Immediate_UnQuote (Primitive "#Macro/Immediate_UnQuote")) @@ -5467,30 +5383,29 @@ {#None} (failure (..wrong_syntax_error (symbol ..Interface))))))) -(def (recursive_type g!self g!dummy name body) - (-> Code Code Text Code Code) - (` {.#Apply (..Primitive "") - (.All ((, g!self) (, g!dummy)) - (, (let$ (local$ name) (` {.#Apply (..Primitive "") (, g!self)}) - body)))})) - (def .public Rec - (macro (_ tokens) - (case tokens - (list [_ {#Symbol "" name}] body) - (do meta#monad - [body' (expansion body) - g!self (generated_symbol "g!self") - g!dummy (generated_symbol "g!dummy")] - (case body' - (list body' labels) - (in (list (..recursive_type g!self g!dummy name body') labels)) + (let [recursive_type (is (-> Code Code Text Code Code) + (function (recursive_type g!self g!dummy name body) + (` {.#Apply (..Primitive "") + (.All ((, g!self) (, g!dummy)) + (, (let$ (local$ name) (` {.#Apply (..Primitive "") (, g!self)}) + body)))})))] + (macro (_ tokens) + (case tokens + (list [_ {#Symbol "" name}] body) + (do meta#monad + [body' (expansion body) + g!self (generated_symbol "g!self") + g!dummy (generated_symbol "g!dummy")] + (case body' + (list body' labels) + (in (list (recursive_type g!self g!dummy name body') labels)) - (list body') - (in (list (..recursive_type g!self g!dummy name body'))) + (list body') + (in (list (recursive_type g!self g!dummy name body'))) - _ - (failure (..wrong_syntax_error (symbol ..Rec))))) + _ + (failure (..wrong_syntax_error (symbol ..Rec))))) - _ - (failure (..wrong_syntax_error (symbol ..Rec)))))) + _ + (failure (..wrong_syntax_error (symbol ..Rec))))))) diff --git a/stdlib/source/library/lux/control/function/inline.lux b/stdlib/source/library/lux/control/function/inline.lux index 6d5f3bebf..a06d2daf7 100644 --- a/stdlib/source/library/lux/control/function/inline.lux +++ b/stdlib/source/library/lux/control/function/inline.lux @@ -11,42 +11,43 @@ ["[0]" meta (.only) ["[0]" code (.only) ["<[1]>" \\parser (.only Parser)]] - ["[0]" macro (.only) - [syntax (.only syntax) - ["|[0]|" export]]]]]]) + ["[0]" macro (.only with_symbols) + [syntax (.only syntax)]]]]]) + +(type Declaration + [Text (List Code)]) (def declaration - (Parser [Text (List Code)]) + (Parser Declaration) (<code>.form (<>.and <code>.local (<>.some <code>.any)))) (def inline - (Parser [Code [Text (List Code)] Code Code]) - (|export|.parser - (all <>.and - ..declaration - <code>.any - <code>.any - ))) + (Parser [Declaration Code Code]) + (all <>.and + ..declaration + <code>.any + <code>.any + )) (def .public inlined - (syntax (_ [[privacy [name parameters] type term] ..inline]) - (do [! meta.monad] - [@ meta.current_module_name - g!parameters (|> (macro.symbol "parameter") - (list.repeated (list.size parameters)) - (monad.all !)) - .let [inlined (` (("lux in-module" - (, (code.text @)) - (.is (, type) - (.function ((, (code.local name)) (,* parameters)) - (, term)))) - (,* (list#each (function (_ g!parameter) - (` ((,' ,) (, g!parameter)))) - g!parameters)))) - g!parameters (|> g!parameters - (list#each (function (_ parameter) - (list parameter (` <code>.any)))) - list#conjoint)]] - (in (list (` (def (, privacy) (, (code.local name)) - (syntax ((, (code.local name)) [(,* g!parameters)]) + (syntax (_ [[[name parameters] type term] ..inline]) + (with_symbols [g!_] + (do [! meta.monad] + [@ meta.current_module_name + g!parameters (|> (macro.symbol "parameter") + (list.repeated (list.size parameters)) + (monad.all !)) + .let [inlined (` (("lux in-module" + (, (code.text @)) + (.is (, type) + (.function ((, (code.local name)) (,* parameters)) + (, term)))) + (,* (list#each (function (_ g!parameter) + (` ((,' ,) (, g!parameter)))) + g!parameters)))) + g!parameters (|> g!parameters + (list#each (function (_ parameter) + (list parameter (` <code>.any)))) + list#conjoint)]] + (in (list (` (syntax ((, g!_) [(,* g!parameters)]) (.at meta.monad (,' in) (.list (.`' (, inlined)))))))))))) diff --git a/stdlib/source/library/lux/debug.lux b/stdlib/source/library/lux/debug.lux index a4866a106..ad5fa71fb 100644 --- a/stdlib/source/library/lux/debug.lux +++ b/stdlib/source/library/lux/debug.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except private) + [lux (.except private type) ["[0]" ffi (.only import)] [abstract ["[0]" monad (.only do)]] @@ -81,7 +81,7 @@ ("static" isArray [.Any] ffi.Boolean))) @.python - (these (type PyType + (these (.type PyType (Primitive "python_type")) (import (type [.Any] PyType)) @@ -385,7 +385,7 @@ (exception.report (list ["Type" (%.type type)]))) -(type Representation +(.type Representation (-> Any Text)) (def primitive_representation @@ -547,7 +547,7 @@ expectedT meta.expected_type] (function.constant (exception.except ..type_hole [location expectedT]))))) -(type Target +(.type Target [Text (Maybe Code)]) (def target diff --git a/stdlib/source/library/lux/ffi/export.js.lux b/stdlib/source/library/lux/ffi/export.js.lux index 66009f8ba..3f8561b78 100644 --- a/stdlib/source/library/lux/ffi/export.js.lux +++ b/stdlib/source/library/lux/ffi/export.js.lux @@ -18,8 +18,9 @@ ["[0]" static] ["[0]" code (.only) ["<[1]>" \\parser]] - ["[0]" macro (.only) - [syntax (.only syntax)]] + [macro + [syntax (.only syntax)] + ["[0]" expansion]] [target ["/" js]] [compiler @@ -88,7 +89,7 @@ (syntax (_ [exports (<>.many <code>.any)]) (let [! meta.monad] (|> exports - (monad.each ! macro.expansion) + (monad.each ! expansion.complete) (at ! each (|>> list#conjoint (monad.each ! ..definition))) (at ! conjoint) diff --git a/stdlib/source/library/lux/ffi/export.lua.lux b/stdlib/source/library/lux/ffi/export.lua.lux index 30af57aa4..c00493f77 100644 --- a/stdlib/source/library/lux/ffi/export.lua.lux +++ b/stdlib/source/library/lux/ffi/export.lua.lux @@ -18,8 +18,9 @@ ["[0]" static] ["[0]" code (.only) ["<[1]>" \\parser]] - ["[0]" macro (.only) - [syntax (.only syntax)]] + [macro + [syntax (.only syntax)] + ["[0]" expansion]] [target ["/" lua]] [compiler @@ -104,7 +105,7 @@ (syntax (_ [exports (<>.many <code>.any)]) (let [! meta.monad] (|> exports - (monad.each ! macro.expansion) + (monad.each ! expansion.complete) (at ! each (|>> list#conjoint (monad.each ! ..definition))) (at ! conjoint) diff --git a/stdlib/source/library/lux/ffi/export.py.lux b/stdlib/source/library/lux/ffi/export.py.lux index 370ed7a9d..7633ed73a 100644 --- a/stdlib/source/library/lux/ffi/export.py.lux +++ b/stdlib/source/library/lux/ffi/export.py.lux @@ -18,8 +18,9 @@ ["[0]" static] ["[0]" code (.only) ["<[1]>" \\parser]] - ["[0]" macro (.only) - [syntax (.only syntax)]] + [macro + [syntax (.only syntax)] + ["[0]" expansion]] [target ["/" python]] [compiler @@ -81,7 +82,7 @@ (syntax (_ [exports (<>.many <code>.any)]) (let [! meta.monad] (|> exports - (monad.each ! macro.expansion) + (monad.each ! expansion.complete) (at ! each (|>> list#conjoint (monad.each ! ..definition))) (at ! conjoint) diff --git a/stdlib/source/library/lux/ffi/export.rb.lux b/stdlib/source/library/lux/ffi/export.rb.lux index 1558aad67..7a102720a 100644 --- a/stdlib/source/library/lux/ffi/export.rb.lux +++ b/stdlib/source/library/lux/ffi/export.rb.lux @@ -20,8 +20,9 @@ ["[0]" type] ["[0]" code (.only) ["<[1]>" \\parser]] - ["[0]" macro (.only) - [syntax (.only syntax)]] + [macro + [syntax (.only syntax)] + ["[0]" expansion]] [target ["/" ruby]] [compiler @@ -130,7 +131,7 @@ (syntax (_ [exports (<>.many <code>.any)]) (let [! meta.monad] (|> exports - (monad.each ! macro.expansion) + (monad.each ! expansion.complete) (at ! each (|>> list#conjoint (monad.each ! ..definition))) (at ! conjoint) diff --git a/stdlib/source/library/lux/ffi/node_js.js.lux b/stdlib/source/library/lux/ffi/node_js.js.lux index 1f3f2fb4a..3ee4c8d33 100644 --- a/stdlib/source/library/lux/ffi/node_js.js.lux +++ b/stdlib/source/library/lux/ffi/node_js.js.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except) + [lux (.except require) ["[0]" ffi] [control ["[0]" function] diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/jvm.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/jvm.lux index 36047a0ed..09010717a 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/jvm.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/jvm.lux @@ -57,7 +57,7 @@ ["[0]" parser] ["[0]" alias (.only Aliasing)] ["[0]T" lux (.only Mapping)]]]] - ["[0]" type (.only) + ["[0]" type (.use "[1]#[0]" equivalence) ["[0]" check (.only Check) (.use "[1]#[0]" monad)]]]]] ["[0]" // ["[1][0]" lux (.only custom)] @@ -92,7 +92,8 @@ (import java/lang/Object "[1]::[0]" - (equals [java/lang/Object] boolean)) + (equals [java/lang/Object] boolean) + (toString [] java/lang/String)) (import java/lang/reflect/Type "[1]::[0]") @@ -282,12 +283,12 @@ [too_many_candidates] ) -(exception .public (cannot_cast [from .Type - to .Type +(exception .public (cannot_cast [from (Type Value) + to (Type Value) value Code]) (exception.report - (list ["From" (%.type from)] - ["To" (%.type to)] + (list ["From" (..signature from)] + ["To" (..signature to)] ["Value" (%.code value)]))) (with_template [<name>] @@ -935,11 +936,11 @@ (in {/////analysis.#Extension extension_name (list (/////analysis.text sub_class) objectA)}) (/////analysis.except cannot_possibly_be_an_instance (format sub_class " !<= " object_class)))))])) -(def (class_candidate_parents class_loader source_name fromT target_name target_class) +(def (class_candidate_parents class_loader from_name fromT to_name to_class) (-> java/lang/ClassLoader External .Type External (java/lang/Class java/lang/Object) (Operation (List [[Text .Type] Bit]))) (do [! phase.monad] - [source_class (phase.lifted (reflection!.load class_loader source_name)) - mapping (phase.lifted (reflection!.correspond source_class fromT))] + [from_class (phase.lifted (reflection!.load class_loader from_name)) + mapping (phase.lifted (reflection!.correspond from_class fromT))] (monad.each ! (function (_ superJT) (do ! @@ -947,32 +948,16 @@ .let [super_name (..reflection superJT)] super_class (phase.lifted (reflection!.load class_loader super_name)) superT (reflection_type mapping superJT)] - (in [[super_name superT] (java/lang/Class::isAssignableFrom super_class target_class)]))) - (case (java/lang/Class::getGenericSuperclass source_class) + (in [[super_name superT] (java/lang/Class::isAssignableFrom super_class to_class)]))) + (case (java/lang/Class::getGenericSuperclass from_class) {.#Some super} - (list.partial super (array.list {.#None} (java/lang/Class::getGenericInterfaces source_class))) + (list.partial super (array.list {.#None} (java/lang/Class::getGenericInterfaces from_class))) {.#None} - (if (java/lang/reflect/Modifier::isInterface (java/lang/Class::getModifiers source_class)) + (if (java/lang/reflect/Modifier::isInterface (java/lang/Class::getModifiers from_class)) {.#Item (as java/lang/reflect/Type (ffi.class_for java/lang/Object)) - (array.list {.#None} (java/lang/Class::getGenericInterfaces source_class))} - (array.list {.#None} (java/lang/Class::getGenericInterfaces source_class))))))) - -(def (inheritance_candidate_parents class_loader fromT target_class toT fromC) - (-> java/lang/ClassLoader .Type (java/lang/Class java/lang/Object) .Type Code (Operation (List [[Text .Type] Bit]))) - (case fromT - {.#Primitive _ (list.partial self_classT super_classT super_interfacesT+)} - (monad.each phase.monad - (function (_ superT) - (do [! phase.monad] - [super_name (at ! each ..reflection (check_jvm superT)) - super_class (phase.lifted (reflection!.load class_loader super_name))] - (in [[super_name superT] - (java/lang/Class::isAssignableFrom super_class target_class)]))) - (list.partial super_classT super_interfacesT+)) - - _ - (/////analysis.except ..cannot_cast [fromT toT fromC]))) + (array.list {.#None} (java/lang/Class::getGenericInterfaces from_class))} + (array.list {.#None} (java/lang/Class::getGenericInterfaces from_class))))))) (def (object::cast class_loader) (-> java/lang/ClassLoader Handler) @@ -981,18 +966,20 @@ (list fromC) (do [! phase.monad] [toT (///.lifted meta.expected_type) - target_name (at ! each ..reflection (check_jvm toT)) + toJT (check_jvm toT) [fromT fromA] (typeA.inferring (analyse archive fromC)) - source_name (at ! each ..reflection (check_jvm fromT)) + fromJT (check_jvm fromT) + .let [from_name (..reflection fromJT) + to_name (..reflection toJT)] can_cast? (is (Operation Bit) (`` (cond (,, (with_template [<primitive> <object>] [(let [=primitive (reflection.reflection <primitive>)] - (or (and (text#= =primitive source_name) - (or (text#= <object> target_name) - (text#= =primitive target_name))) - (and (text#= <object> source_name) - (text#= =primitive target_name)))) + (or (and (text#= =primitive from_name) + (or (text#= <object> to_name) + (text#= =primitive to_name))) + (and (text#= <object> from_name) + (text#= =primitive to_name)))) (in true)] [reflection.boolean box.boolean] @@ -1006,34 +993,39 @@ ... else (do ! - [_ (phase.assertion ..primitives_are_not_objects [source_name] - (not (dictionary.key? ..boxes source_name))) - _ (phase.assertion ..primitives_are_not_objects [target_name] - (not (dictionary.key? ..boxes target_name))) - target_class (phase.lifted (reflection!.load class_loader target_name)) - _ (do ! - [source_class (phase.lifted (reflection!.load class_loader source_name))] - (phase.assertion ..cannot_cast [fromT toT fromC] - (java/lang/Class::isAssignableFrom source_class target_class)))] - (loop (again [[current_name currentT] [source_name fromT]]) - (if (text#= target_name current_name) - (in true) - (do ! - [candidate_parents (is (Operation (List [[Text .Type] Bit])) - (class_candidate_parents class_loader current_name currentT target_name target_class))] - (case (|> candidate_parents - (list.only product.right) - (list#each product.left)) - {.#Item [next_name nextT] _} - (again [next_name nextT]) - - {.#End} - (in false)))))))))] + [_ (phase.assertion ..primitives_are_not_objects [from_name] + (not (dictionary.key? ..boxes from_name))) + _ (phase.assertion ..primitives_are_not_objects [to_name] + (not (dictionary.key? ..boxes to_name))) + to_class (phase.lifted (reflection!.load class_loader to_name)) + from_class (phase.lifted (reflection!.load class_loader from_name))] + (if (java/lang/Class::isAssignableFrom from_class to_class) + (loop (again [[current_name currentT] [from_name fromT]]) + (if (text#= to_name current_name) + (in true) + (do ! + [candidate_parents (is (Operation (List [[Text .Type] Bit])) + (class_candidate_parents class_loader current_name currentT to_name to_class))] + (case (|> candidate_parents + (list.only product.right) + (list#each product.left)) + {.#Item [next_name nextT] _} + (again [next_name nextT]) + + {.#End} + (in false))))) + (in (case [(type#= java/lang/Object fromT) + (parser.array? toJT)] + [#1 {.#Some _}] + true + + _ + false)))))))] (if can_cast? - (in {/////analysis.#Extension extension_name (list (/////analysis.text source_name) - (/////analysis.text target_name) + (in {/////analysis.#Extension extension_name (list (/////analysis.text from_name) + (/////analysis.text to_name) fromA)}) - (/////analysis.except ..cannot_cast [fromT toT fromC]))) + (/////analysis.except ..cannot_cast [fromJT toJT fromC]))) _ (/////analysis.except ///.invalid_syntax [extension_name %.code args])))) diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/runtime.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/runtime.lux index 270ff3256..437f6624d 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/runtime.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/runtime.lux @@ -796,7 +796,7 @@ @array//delete )) -(def runtime +(def full Statement (all _.then runtime//structure @@ -814,13 +814,13 @@ (def .public generate (Operation [Registry Output]) (do ///////phase.monad - [_ (/////generation.execute! ..runtime) - _ (/////generation.save! ..module_id {.#None} ..runtime)] + [_ (/////generation.execute! ..full) + _ (/////generation.save! ..module_id {.#None} ..full)] (in [(|> registry.empty (registry.resource true unit.none) product.right) (sequence.sequence [..module_id {.#None} - (|> ..runtime + (|> ..full _.code (at utf8.codec encoded))])]))) diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua/runtime.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua/runtime.lux index 8a124aadc..e8ba62726 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua/runtime.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua/runtime.lux @@ -427,7 +427,7 @@ @array//write )) -(def runtime +(def full Statement (all _.then ..runtime//adt @@ -440,13 +440,13 @@ (def .public generate (Operation [Registry Output]) (do ///////phase.monad - [_ (/////generation.execute! ..runtime) - _ (/////generation.save! ..module_id {.#None} ..runtime)] + [_ (/////generation.execute! ..full) + _ (/////generation.save! ..module_id {.#None} ..full)] (in [(|> registry.empty (registry.resource true unit.none) product.right) (sequence.sequence [..module_id {.#None} - (|> ..runtime + (|> ..full _.code (at utf8.codec encoded))])]))) diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby/runtime.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby/runtime.lux index 194b97c7e..b193b5b84 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby/runtime.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby/runtime.lux @@ -595,11 +595,11 @@ @array//write )) -(def runtime +(def full Statement (all _.then (_.when ..mruby? - ... We're in DragonRuby territory. + ... We're in mRuby/DragonRuby territory. (_.statement (_.do "class_eval" (list) {.#Some [(list (_.local "_")) (_.statement @@ -617,13 +617,13 @@ (def .public generate (Operation [Registry Output]) (do ///////phase.monad - [_ (/////generation.execute! ..runtime) - _ (/////generation.save! ..module_id {.#None} ..runtime)] + [_ (/////generation.execute! ..full) + _ (/////generation.save! ..module_id {.#None} ..full)] (in [(|> registry.empty (registry.resource true unit.none) product.right) (sequence.sequence [..module_id {.#None} - (|> ..runtime + (|> ..full _.code (at utf8.codec encoded))])]))) diff --git a/stdlib/source/library/lux/meta/macro/pattern.lux b/stdlib/source/library/lux/meta/macro/pattern.lux index 4c78c8c36..367c77bd4 100644 --- a/stdlib/source/library/lux/meta/macro/pattern.lux +++ b/stdlib/source/library/lux/meta/macro/pattern.lux @@ -11,8 +11,8 @@ ["[0]" try]] [data [collection - ["[0]" list (.use "[1]#[0]" monoid monad)]]]]] - ["[0]" // (.only) + ["[0]" list (.use "[1]#[0]" monoid monad mix)]]]]] + ["[0]" // (.only with_symbols) [vocabulary (.only vocabulary)] ["/[1]" // (.use "[1]#[0]" monad)]]) @@ -40,7 +40,6 @@ [tuple_list] [text$] - [generated_symbol] [type_definition] [record_slots] [text#composite] @@ -50,8 +49,6 @@ [tuple$] [zipped_2] - [multi_level_case^] - [multi_level_case$] [type_code] [expected_type] @@ -116,35 +113,81 @@ _ (///.failure (..wrong_syntax_error (symbol ..with_template))))))) +(type Level + [Code Code]) + +(def (level it) + (-> Code (Meta Level)) + (///#in (case it + [_ {.#Tuple (list expr binding)}] + [expr binding] + + _ + [it (.` #1)]))) + +(type Multi + [Code (List Level)]) + +(def (multiP levels) + (-> (List Code) (Meta Multi)) + (case levels + {.#End} + (///.failure "Multi-level patterns cannot be empty.") + + {.#Item init extras} + (do ///.monad + [extras' (monad.each ///.monad ..level extras)] + (in [init extras'])))) + +(def (multiG g!_ [[init_pattern levels] body]) + (-> Code [Multi Code] (List Code)) + (.let [inner_pattern_body (list#mix (function (_ [calculation pattern] success) + (.let [bind? (case pattern + [_ {.#Symbol _}] + #1 + + _ + #0)] + (.` (case (., calculation) + (., pattern) + (., success) + + (.,* (if bind? + (list) + (list g!_ (.` {.#None})))))))) + (.` {.#Some (., body)}) + (list.reversed levels))] + (list init_pattern inner_pattern_body))) + (def .public multi (pattern (macro (_ tokens) (case tokens (list.partial [_meta {.#Form levels}] body next_branches) - (do ///.monad - [mlc (multi_level_case^ levels) - .let [initial_bind? (case mlc - [[_ {.#Symbol _}] _] - #1 - - _ - #0)] - expected ..expected_type - g!temp (..generated_symbol "temp")] - (in (list g!temp - (.` ({{.#Some (., g!temp)} - (., g!temp) - - {.#None} - (.case (., g!temp) - (.,* next_branches))} - ("lux type check" {.#Apply (., (type_code expected)) Maybe} - (.case (., g!temp) - (.,* (multi_level_case$ g!temp [mlc body])) - - (.,* (if initial_bind? - (list) - (list g!temp (.` {.#None}))))))))))) + (with_symbols [g!temp] + (do ///.monad + [mlc (multiP levels) + .let [initial_bind? (case mlc + [[_ {.#Symbol _}] _] + #1 + + _ + #0)] + expected ..expected_type] + (in (list g!temp + (.` ({{.#Some (., g!temp)} + (., g!temp) + + {.#None} + (.case (., g!temp) + (.,* next_branches))} + ("lux type check" {.#Apply (., (type_code expected)) Maybe} + (.case (., g!temp) + (.,* (multiG g!temp [mlc body])) + + (.,* (if initial_bind? + (list) + (list g!temp (.` {.#None})))))))))))) _ (///.failure (..wrong_syntax_error (symbol ..multi))))))) @@ -237,12 +280,11 @@ (def (untemplated_pattern pattern) (-> Code (Meta Code)) - (do ///.monad - [g!meta (..generated_symbol "g!meta")] + (with_symbols [g!meta] (case pattern (..with_template [<tag> <gen>] [[_ {<tag> value}] - (in (.` [(., g!meta) {<tag> (., (<gen> value))}]))]) + (///#in (.` [(., g!meta) {<tag> (., (<gen> value))}]))]) ([.#Bit bit$] [.#Nat nat$] [.#Int int$] @@ -252,11 +294,11 @@ [.#Symbol name$]) [@composite {.#Form {.#Item [@global {.#Symbol global}] parameters}}] - (do ///.monad + (do [! ///.monad] [micro (///.try (..named_unquote global))] (case micro {try.#Success micro} - (do ///.monad + (do ! [[_ output] (..one_expansion ((//.function micro) parameters))] (in [@composite output])) diff --git a/stdlib/source/test/lux/control/function/inline.lux b/stdlib/source/test/lux/control/function/inline.lux index 441ddef3c..94a21ede2 100644 --- a/stdlib/source/test/lux/control/function/inline.lux +++ b/stdlib/source/test/lux/control/function/inline.lux @@ -15,9 +15,10 @@ (template (_ m0 m1) [(i.+ (i.* m0 m0) (i.* m1 m1))])) -(/.inlined .public (quadrance/2 m0 m1) - (-> Int Int Int) - (!quadrance/2 m0 m1)) +(def .public quadrance/2 + (/.inlined (_ m0 m1) + (-> Int Int Int) + (!quadrance/2 m0 m1))) (def .public test Test diff --git a/stdlib/source/test/lux/meta/extension.lux b/stdlib/source/test/lux/meta/extension.lux index 8be85f9c0..bfe11a0e0 100644 --- a/stdlib/source/test/lux/meta/extension.lux +++ b/stdlib/source/test/lux/meta/extension.lux @@ -33,13 +33,13 @@ ["[0]" ruby] ["[0]" php] ["[0]" scheme] - ["[0]" jvm - (.,, (.for "JVM" (.,, (.these ["[1]" bytecode] + (.,, (.for "JVM" (.,, (.these ["[0]" jvm + ["[1]" bytecode] ["[0]" class] ["[0]" version] [encoding - ["[0]" name]])) - (.,, (.these))))]] + ["[0]" name]]])) + (.,, (.these))))] [compiler ["[0]" phase] [meta diff --git a/stdlib/source/test/lux/meta/target/js.lux b/stdlib/source/test/lux/meta/target/js.lux index 9604b26b3..94fc0c470 100644 --- a/stdlib/source/test/lux/meta/target/js.lux +++ b/stdlib/source/test/lux/meta/target/js.lux @@ -3,13 +3,13 @@ [lux (.except) ["_" test (.only Test)] [abstract - [monad (.only do)] - ["[0]" predicate]] + [monad (.only do)]] [control ["[0]" pipe] - ["[0]" function] ["[0]" maybe (.use "[1]#[0]" functor)] - ["[0]" try (.only Try) (.use "[1]#[0]" functor)]] + ["[0]" try (.only Try) (.use "[1]#[0]" functor)] + ["[0]" function (.only) + ["[0]" predicate]]] [data ["[0]" bit (.use "[1]#[0]" equivalence)] ["[0]" text (.only \n) (.use "[1]#[0]" equivalence) diff --git a/stdlib/source/unsafe/lux/data/binary.lux b/stdlib/source/unsafe/lux/data/binary.lux index e90aa4b39..d3b824dfb 100644 --- a/stdlib/source/unsafe/lux/data/binary.lux +++ b/stdlib/source/unsafe/lux/data/binary.lux @@ -306,26 +306,27 @@ (again ("lux i64 +" 1 index))))))))])))) ... TODO: Turn into a template ASAP. -(`` (inlined .public (copy! bytes source_offset source target_offset target) - (-> .Nat .Nat ..Binary Nat ..Binary ..Binary) - (with_expansions [<jvm> (java/lang/System::arraycopy source (ffi.as_int (.int source_offset)) - target (ffi.as_int (.int target_offset)) - (ffi.as_int (.int bytes))) - <jvm> (.exec - <jvm> - target)] - (.for (,, (.static @.old)) <jvm> - (,, (.static @.jvm)) <jvm> - - ... Default - (.loop (again [index 0]) - (.if ("lux i64 <" (.int bytes) (.int index)) - (.exec - (..has_8! ("lux i64 +" target_offset index) - (..bits_8 ("lux i64 +" source_offset index) source) - target) - (again ("lux i64 +" 1 index))) - target)))))) +(`` (def .public copy! + (inlined (_ bytes source_offset source target_offset target) + (-> .Nat .Nat ..Binary Nat ..Binary ..Binary) + (with_expansions [<jvm> (java/lang/System::arraycopy source (ffi.as_int (.int source_offset)) + target (ffi.as_int (.int target_offset)) + (ffi.as_int (.int bytes))) + <jvm> (.exec + <jvm> + target)] + (.for (,, (.static @.old)) <jvm> + (,, (.static @.jvm)) <jvm> + + ... Default + (.loop (again [index 0]) + (.if ("lux i64 <" (.int bytes) (.int index)) + (.exec + (..has_8! ("lux i64 +" target_offset index) + (..bits_8 ("lux i64 +" source_offset index) source) + target) + (again ("lux i64 +" 1 index))) + target))))))) ... TODO: Turn into a template ASAP. (`` (with_expansions [<jvm> (java/util/Arrays::copyOfRange binary @@ -333,10 +334,11 @@ (ffi.as_int (.int limit))) <jvm> (.let [limit ("lux i64 +" size offset)] <jvm>)] - (inlined .public (slice offset size binary) - (-> .Nat .Nat ..Binary ..Binary) - (.for (,, (.static @.old)) <jvm> - (,, (.static @.jvm)) <jvm> - - ... Default - (..copy! size offset binary 0 (..empty size)))))) + (def .public slice + (inlined (_ offset size binary) + (-> .Nat .Nat ..Binary ..Binary) + (.for (,, (.static @.old)) <jvm> + (,, (.static @.jvm)) <jvm> + + ... Default + (..copy! size offset binary 0 (..empty size))))))) |