diff --git a/source/tutorials/nix-language.md b/source/tutorials/nix-language.md index af137d5..2bcc196 100644 --- a/source/tutorials/nix-language.md +++ b/source/tutorials/nix-language.md @@ -766,62 +766,4 @@ The `meta` attribute is itself an attribute set, where the `license` attribute h (This example is a (simplified) package declaration from `nixpkgs`.) -# Nix language properties - -As a programming language, Nix is - -- *declarative* - - It has no notion of executing sequential steps. - Dependencies between operations are established only through data. - -- *purely functional* - - Pure means: Nix does not change the value of declarations during computation – there are no actual variables, only names for immutable values. - - Functional means: In Nix, functions are like any other value. - Functions can be assigned to names, taken as arguments, or returned by functions. - -- *lazy* - - It will only evaluate expressions when their result is needed.[^4] - -- *dynamically typed* - - Type errors are only detected when expressions are actually evaluated.[^5] - -- *purpose-built* - - The Nix language only exists for the Nix package manager. - It is not intended for general purpose use. - -[^4]: For example, the built-in function `throw` causes evaluation to stop. However, the following works, because `throw` is never evaluated: - - ```nix - let lazy = { a = "success"; b = builtins.throw "error"; }; in lazy.a - ``` - - "success" - -[^5]: For example, while one cannot add integers to strings, the error is not detected by simply parsing the meaningless expression. - - ```nix - let x = { a = 1 + "1"; b = 2; }; in x.b - ``` - - 2 - - The error only detected on evaluation, that is, when trying to access the result. - - ```nix - let x = { a = 1 + "1"; b = 2; }; in x.a - ``` - - error: cannot add a string to an integer - - at «string»:1:19: - - 1| let x = { a = 1 + "1"; b = 2; }; in x.a - | ^ - 2|