From 7249707e7c09be68dfb7507ba363efd3300a0141 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 16 Jun 2022 21:37:38 -0400 Subject: De-sigil-ification: suffix : [Part 14] --- .../the_lux_programming_language/appendix_a.md | 28 +++++++++++----------- .../book/the_lux_programming_language/chapter_1.md | 2 +- .../the_lux_programming_language/chapter_10.md | 2 +- .../the_lux_programming_language/chapter_11.md | 2 +- .../the_lux_programming_language/chapter_16.md | 4 ++-- .../the_lux_programming_language/chapter_18.md | 2 +- .../book/the_lux_programming_language/chapter_2.md | 8 +++---- .../book/the_lux_programming_language/chapter_4.md | 2 +- .../book/the_lux_programming_language/chapter_7.md | 6 ++--- .../book/the_lux_programming_language/chapter_8.md | 8 +++---- .../book/the_lux_programming_language/chapter_9.md | 2 +- 11 files changed, 33 insertions(+), 33 deletions(-) (limited to 'documentation/book') diff --git a/documentation/book/the_lux_programming_language/appendix_a.md b/documentation/book/the_lux_programming_language/appendix_a.md index 4002c13e9..605658385 100644 --- a/documentation/book/the_lux_programming_language/appendix_a.md +++ b/documentation/book/the_lux_programming_language/appendix_a.md @@ -5,7 +5,7 @@ You've already seen some import syntax, but now you'll see all the options avail If you recall [Chapter 1](chapter_1.md), there was this example code: ```clojure -(.using +(.require [library [lux "*" [program {"+" program:}] @@ -38,7 +38,7 @@ We also give both of those modules local aliases. That is what that `"[0]"` syntax does. -The `.using` macro recognizes that syntax for aliases and replaces the `[0]` with the import name directly to the right. +The `.require` macro recognizes that syntax for aliases and replaces the `[0]` with the import name directly to the right. That means: * `"[0]"` + `debug` = `debug` @@ -52,10 +52,10 @@ So, for example: It is also important to note that while imports can be nested for convenience, they don't have to be. -The `.using` declaration could just as easily been written like this: +The `.require` declaration could just as easily been written like this: ```clojure -(.using +(.require [library/lux "*"] [library/lux/program {"+" program:}] ["debug" library/lux/debug] @@ -68,12 +68,12 @@ Any module-path fragments included in the import syntax without such options wil --- -It is also possible to have the `.using` macro open interface implementations for you when importing the modules that contain them. +It is also possible to have the `.require` macro open interface implementations for you when importing the modules that contain them. For example: ```clojure -(.using +(.require [library [lux "*" [data @@ -105,7 +105,7 @@ The `[1]` syntax for aliasing can also be used between modules, and not just whe For example: ```clojure -(.using +(.require [library [lux "*" [data @@ -125,7 +125,7 @@ Non-aliased paths don't count as context. This means: ```clojure -(.using +(.require [library [lux "*" ["[0]" data "_" @@ -145,7 +145,7 @@ I should also note that you can **both** locally import definitions and open imp For example: ```clojure -(.using +(.require [library [lux "*" [data @@ -178,7 +178,7 @@ You can import other modules in the hierarchy like this: ```clojure ... In program/foo/baz -(.using +(.require [library [lux "*"]] ["[0]" /quux] ... program/foo/baz/quux, aliased as /quux @@ -191,7 +191,7 @@ A single forward slash (`/`) signifies _"this module"_ in the hierarchy, so anyt Two forward slashes (`//`) signify _"the module above"_, and any forward slash after that allows you to go further **up** the hierarchy. -In the case of `program`, it's enough to just specify three forward slashes (`///`) for the `.using` macro to know which module you're referring to. +In the case of `program`, it's enough to just specify three forward slashes (`///`) for the `.require` macro to know which module you're referring to. You can think about it like this: @@ -203,7 +203,7 @@ Also, this relative path syntax can be nested, like so: ```clojure ... In program/foo/baz -(.using +(.require [library [lux "*"]] [/ @@ -219,7 +219,7 @@ Or even: ```clojure ... In program/foo/baz -(.using +(.require [library [lux "*"]] [/ @@ -240,7 +240,7 @@ For the second way to do relative imports, you can see this example: ```clojure ... In program/foo/baz -(.using +(.require [library [lux "*"]] [\\test diff --git a/documentation/book/the_lux_programming_language/chapter_1.md b/documentation/book/the_lux_programming_language/chapter_1.md index 04c9df452..63059fd62 100644 --- a/documentation/book/the_lux_programming_language/chapter_1.md +++ b/documentation/book/the_lux_programming_language/chapter_1.md @@ -55,7 +55,7 @@ These are the steps: 4. Create `my_project/source/main.lux` and add this code to it: ```clojure -(.using +(.require [library [lux "*" [program {"+" program:}] diff --git a/documentation/book/the_lux_programming_language/chapter_10.md b/documentation/book/the_lux_programming_language/chapter_10.md index 6c86c9671..73fe729ea 100644 --- a/documentation/book/the_lux_programming_language/chapter_10.md +++ b/documentation/book/the_lux_programming_language/chapter_10.md @@ -36,7 +36,7 @@ Macros allow you to implement your own features in the language and to have them I mean, beyond the native syntax for writing numbers, text, variants, tuples and records, every single thing you have written so far has been macros. -`.using` import statements? _Yep, macros_. +`.require` import statements? _Yep, macros_. Definition statements? _Yep, macros_. diff --git a/documentation/book/the_lux_programming_language/chapter_11.md b/documentation/book/the_lux_programming_language/chapter_11.md index 56115b830..a069c4c9e 100644 --- a/documentation/book/the_lux_programming_language/chapter_11.md +++ b/documentation/book/the_lux_programming_language/chapter_11.md @@ -76,7 +76,7 @@ Here is an example: ```clojure ... Taken from library/lux/math/infix. -(.using +(.require [library [lux "*" [abstract diff --git a/documentation/book/the_lux_programming_language/chapter_16.md b/documentation/book/the_lux_programming_language/chapter_16.md index be5456dbf..72f9e3616 100644 --- a/documentation/book/the_lux_programming_language/chapter_16.md +++ b/documentation/book/the_lux_programming_language/chapter_16.md @@ -44,7 +44,7 @@ The `"test"` parameter specifies the name of a Lux module that serves as the ent Here is a summary of the file: ```clojure -(.using +(.require [library ["/" lux "*" [program {"+" program:}] @@ -80,7 +80,7 @@ To know how tests work, let's take a look at one of those modules. From `test/lux/data/collection/stack`. ```clojure -(.using +(.require [library [lux "*" ["_" test {"+" Test}] diff --git a/documentation/book/the_lux_programming_language/chapter_18.md b/documentation/book/the_lux_programming_language/chapter_18.md index 51f12bbbb..83a87f1ae 100644 --- a/documentation/book/the_lux_programming_language/chapter_18.md +++ b/documentation/book/the_lux_programming_language/chapter_18.md @@ -85,7 +85,7 @@ And so, Lux provides 4 different types of extensions. The first type of extension we'll see is the `Analysis` extension: ```clojure -(.using +(.require [library [lux "*" [extension {"+" [analysis: synthesis: generation:]}] diff --git a/documentation/book/the_lux_programming_language/chapter_2.md b/documentation/book/the_lux_programming_language/chapter_2.md index c4f566736..ed1a5620f 100644 --- a/documentation/book/the_lux_programming_language/chapter_2.md +++ b/documentation/book/the_lux_programming_language/chapter_2.md @@ -80,7 +80,7 @@ Directives looks similar to expressions, except that their purpose is not to pro This is a bit of a fuzzy line, since some things which also communicate stuff to the compiler are actually expressions (for example, type annotations, which we'll see in next chapter). -Examples of directives are `.using` declarations at the top of modules, and definitions of all kinds (such as program definitions). +Examples of directives are `.require` declarations at the top of modules, and definitions of all kinds (such as program definitions). ## Programs @@ -112,7 +112,7 @@ In the previous chapter we compiled and ran a Lux program, but nothing has been ```clojure ... This will be our program's main module. -(.using +(.require [library [lux "*" [program {"+" program:}] @@ -124,13 +124,13 @@ In the previous chapter we compiled and ran a Lux program, but nothing has been (io.io (debug.log! "Hello, world!"))) ``` -The first part of this program specifies which dependencies we're `using`. +The first part of this program specifies which dependencies we `require`. All Lux modules automatically import the `library/lux` module, but they don't locally import every single definition, so everything would have to be accessed by using the `library/lux.` prefix or the `.` (short-cut) prefix. To avoid that, we import the `library/lux` module in a plain way. - By the way, what I just explained about the `library/lux` module is the reason why we couldn't just use the `.using` macro as `using`. + By the way, what I just explained about the `library/lux` module is the reason why we couldn't just use the `.require` macro as `require`. Then we import the `library/lux/control/io` module. We're giving this module an alias, using that `"[0]"` syntax. The way aliasing works here is that it replaces the `[0]` with the short name of the import, and so `[0]` becomes `io`, and that is the alias given to the import. The same process happens when we import the `library/lux/debug` module. This might seems weird and sort of useless, but the aliasing syntax has some more features and flexibility, enabling you to have your own naming convention when importing modules. diff --git a/documentation/book/the_lux_programming_language/chapter_4.md b/documentation/book/the_lux_programming_language/chapter_4.md index 5dfa20328..201d0cc28 100644 --- a/documentation/book/the_lux_programming_language/chapter_4.md +++ b/documentation/book/the_lux_programming_language/chapter_4.md @@ -138,7 +138,7 @@ The reason it exists is that Lux's arithmetic functions are not polymorphic on t If you import the module for `Nat` numbers, like so: ```clojure -(.using +(.require [library [lux [math diff --git a/documentation/book/the_lux_programming_language/chapter_7.md b/documentation/book/the_lux_programming_language/chapter_7.md index 53bc97890..5c828585d 100644 --- a/documentation/book/the_lux_programming_language/chapter_7.md +++ b/documentation/book/the_lux_programming_language/chapter_7.md @@ -155,7 +155,7 @@ We've put functions and values inside our implementations. It's time to get them out and use them. -There are 2 main ways to use the stuff inside your implementations: `open:` and `#`. +There are 2 main ways to use the stuff inside your implementations: `use` and `#`. Let's check them out. @@ -170,11 +170,11 @@ Let's check them out. (def .private i::< (# library/lux/math/number/int.order <)) ``` -The `open:` macro serves as a directive that creates private/un-exported definitions in your module for every member of a particular implementation. +The `use` macro serves as a directive that creates private/un-exported definitions in your module for every member of a particular implementation. You may also give it an optional _aliasing pattern_ for the definitions, in case you want to avoid any name clash. - You might want to check out [Appendix C](appendix_c.md) to discover a pattern-matching macro version of `open:` called `^open`. + You might want to check out [Appendix C](appendix_c.md) to discover a pattern-matching macro version of `use` called `^open`. ```clojure ... Allows accessing the value of a implementation's member. diff --git a/documentation/book/the_lux_programming_language/chapter_8.md b/documentation/book/the_lux_programming_language/chapter_8.md index 8c262b355..2759ad62d 100644 --- a/documentation/book/the_lux_programming_language/chapter_8.md +++ b/documentation/book/the_lux_programming_language/chapter_8.md @@ -209,14 +209,14 @@ The thing about `Monad` is that, with it, you can use `each` functions that also Let's see that in action: ```clojure -(.using +(.require [library [lux "*" [data [collection ["[0]" list]]]]]) -(open: list.monad) +(use list.monad) (def foo (|> (list 1 2 3 4) @@ -268,7 +268,7 @@ Not really. It's just the `Monad` for `List`: {.#Item x xs'} {.#Item x (compose xs' ys)}))) -(open: "[0]" ..monoid) +(use "[0]" ..monoid) (implementation: .public monad (Monad List) @@ -300,7 +300,7 @@ Time for the VIP treatment. These macros always show up at the right time to saves us from our hurdles! ```clojure -(.using +(.require [library [lux "*" [data diff --git a/documentation/book/the_lux_programming_language/chapter_9.md b/documentation/book/the_lux_programming_language/chapter_9.md index 13d3c2462..a01740f09 100644 --- a/documentation/book/the_lux_programming_language/chapter_9.md +++ b/documentation/book/the_lux_programming_language/chapter_9.md @@ -60,7 +60,7 @@ You can actually write computations that can read and even modify (_careful with This turns out to be massively useful when implementing a variety of powerful macros. -For example, remember the `open:` and `#` macros from [chapter 7](chapter_7.md)? +For example, remember the `use` and `#` macros from [chapter 7](chapter_7.md)? They actually look up the typing information for the structures you give them to figure out the names of members and generate the code necessary to get that functionality going. -- cgit v1.2.3