From c4a4a1262f1975fd84abd2c2a748a47cc46e45e0 Mon Sep 17 00:00:00 2001 From: Zoom Date: Sun, 12 Dec 2021 15:03:50 +0300 Subject: [PATCH] Use |NimSkull| in the new text. Fix formatting. --- doc/tut1.rst | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/doc/tut1.rst b/doc/tut1.rst index 2cb53548773..695ecba72b0 100644 --- a/doc/tut1.rst +++ b/doc/tut1.rst @@ -879,26 +879,26 @@ whose value is then returned implicitly. Funcs and methods ----------------- -As mentioned in the introduction, Nim differentiates between procedures, +As mentioned in the introduction, |NimSkull| differentiates between procedures, functions, and methods, defined by the `proc`, `func`, and `method` keywords -respectively. In some ways, Nim is a bit more pedantic in its definitions than -other languages. +respectively. In some ways, |NimSkull| is a bit more pedantic in its definitions +than other languages. Functions are essentially procedures with additional limitations set on them: they can't access global state (except `const`) and can't produce side-effects. -This puts Nim functions closer to the concept of a mathematical function, which -might be familiar to you if you've ever done functional programming. The main -benefit of the imposed limits is that it's much easier to reason about the code -with minimized interdependence of its various parts, as data flows directly +This puts |NimSkull| functions closer to the concept of a mathematical function, +which might be familiar to you if you've ever done functional programming. The +main benefit of the imposed limits is that it's much easier to reason about the +code with minimized interdependence of its various parts, as data flows directly through a function from its arguments to its output. The other notable advantage is that the self-contained nature of a function makes it inherently more portable and easier to test. -Even though these benefits apply to Nim functions, it's important to keep in -mind that a `func` can still change its mutable arguments: those marked as `var` -along with `ref` objects (which possess interior mutability). This still allows -functions to have additional outputs beside the return value, making them not as -"pure" as their mathematical counterparts. +Even though these benefits apply to |NimSkull| functions, it's important to keep +in mind that a `func` can still change its mutable arguments: those marked as +`var` along with `ref` objects (which possess interior mutability). This still +allows functions to have additional outputs beside the return value, making them +not as "pure" as their mathematical counterparts. Technically, the `func` keyword is a shorthand alias for `proc` tagged with `{.noSideEffects.}`.