Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a statement about how whitespace is interpreted in Nix code. #22

Open
WayneSherman opened this issue Feb 3, 2024 · 0 comments

Comments

@WayneSherman
Copy link

WayneSherman commented Feb 3, 2024

In code formatting, is whitespace meaningful?
Does the syntax depend on line breaks in any way?

For example, the first time functions are introduced, the full declaration is on one line:

name: "Hello ${name}"

Later an example function declaration takes up 3 lines with a blank line in between:

nix-1p/README.md

Lines 562 to 564 in 1cf10d3

{ stdenv, libsvg }:
stdenv.mkDerivation { ... }

ChatGPT:
"In the Nix language, whitespace is generally used to separate tokens but does not have a significant impact on the interpretation of code beyond this. Unlike some programming languages where indentation or the presence of whitespace can alter the behavior of the code, Nix treats extra spaces, line breaks, and indentation as non-semantic, primarily for improving code readability and organization."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant