Commit Graph
1 Commits
Author SHA1 Message Date
toonn 2698fe8611 manual: Update Attribute Set section to exclude indented strings and URIs
Indented strings and URIs are string literals but they are not allowed
as names for attrsets, `let` or `inherit`. The following snippets
illustrate that they lead to syntax errors.

==> examples/ind_str-attr.nix <==
{
  ''indented string'' = "error: syntax error, expecting '}'";
}

==> examples/ind_str-inherit.nix <==
{ inherit ({ "non-indented string" = "error: syntax error, expecting ';'"; })
    ''non-indented string'';
}

==> examples/ind_str-let.nix <==
let
  ''indented string'' = "error: syntax error, expecting 'in'";
in
  true

==> examples/uri-attr.nix <==
{
  http://example.org/foo.tar.bz2 = "error: syntax error, expecting '}'";
}

==> examples/uri-inherit.nix <==
{ inherit ({ "http://example.org/foo.tar.bz2" = "error: syntax error, expecting ';'"; })
    http://example.org/foo.tar.bz2;
}

==> examples/uri-let.nix <==
let
  http://example.org/foo.tar.bz2 = "error: syntax error, expecting 'in'";
in
  true

Change-Id: I6774af93baf9f533877642a563775667c518ea88
2026-06-06 14:52:54 +00:00