!tDnwWRNkmmYtMXfaZl:nixos.org

Nix Language

1937 Members
Nix programming language362 Servers

Load older messages


SenderMessageTime
6 Jun 2021
@ianf:matrix.orgianfActually, misread $ as @ lol18:57:22
@andrew:mtx.rew.laandrewIs it possible to get an output showing nix's grammar summary similar to how this stale issue suggests? https://github.com/NixOS/nix/pull/40221:50:11
@andrew:mtx.rew.laandrewOr is the grammar summary documented somewhere?21:51:03
@infinisil:matrix.orginfinisilandrew: Well the parser specification is here: https://github.com/NixOS/nix/blob/master/src/libexpr/parser.y21:51:49
@andrew:mtx.rew.laandrewthanks, reading21:52:55
7 Jun 2021
@andrew:mtx.rew.laandrew Are there any ways to pass a variable to a more specific scope other than "let-in" a the inherit keyword? 03:42:46
@andrew:mtx.rew.laandrew * Are there any ways to pass a variable to a sub-scope other than "let-in" a the inherit keyword? 03:43:03
@andrew:mtx.rew.laandrew * Are there any ways to pass a variable to a sub-scope other than "let-in" or the inherit keyword? 03:43:14
@siraben:matrix.orgsiraben andrew: with? 03:45:11
@siraben:matrix.orgsirabennote: with + let interaction can be surprising03:45:38
@andrew:mtx.rew.laandrewraght that too03:45:49
@andrew:mtx.rew.laandrew * right that too03:46:11
@andrew:mtx.rew.laandrew hmm what do you mean? One of the let statements overrides the other if an attribute is +'d? 03:46:35
@andrew:mtx.rew.laandrewRedacted or Malformed Event03:48:46
@andrew:mtx.rew.laandrew 07:48:11
@siraben:matrix.orgsiraben andrew: what do you think let a = 3; in with { a = 5; }; a prints 10:00:16
@siraben:matrix.orgsiraben * andrew: what do you think let a = 3; in with { a = 5; }; a evaluates to 10:00:21
@siraben:matrix.orgsiraben if we had full lexical scope like in most functional languages, we would expect 5 10:00:59
@siraben:matrix.orgsiraben however that evaluates to 3 in Nix. 10:01:03
@andrew:mtx.rew.laandrew so let statements take precedence over with statements? 10:01:40
@sternenseemann:systemli.orgsterniwith set; x couldn't be lexically scoped since the content of a couldn't be determined lexically10:01:53
@sternenseemann:systemli.orgsterni andrew: with won't ever shadow anything that is in scope basically 10:02:04
@andrew:mtx.rew.laandrew oh with + let, not with + let 10:02:35
@sternenseemann:systemli.orgsternihowever it seems that with will shadow existing with bindings10:02:50
@andrew:mtx.rew.laandrewso with never overrides any variables in the scope10:03:06
@sternenseemann:systemli.orgsterni
nix-repl> let x = { a = 12; }; y = { a = 13; }; in with x; with y; a
13
10:03:07
@sternenseemann:systemli.orgsterni andrew: nothing that is bound lexically I guess, like a function argument or a let binding 10:03:36
@andrew:mtx.rew.laandrewwhat will it override?10:04:10
@andrew:mtx.rew.laandrewRedacted or Malformed Event10:04:17
@sternenseemann:systemli.orgsternialso it won't shadow anything that is bound via a rec { } set10:04:33

Show newer messages


Back to Room ListRoom Version: 6