| 20 Mar 2026 |
piegames | In reply to @blokyk:matrix.org sorry to interrupt the debate, but is the fact that break doesn't force its argument (unlike e.g. trace and warn) really intended? it causes break calls to be opaque in some situations (e.g. isAttrs {} != isAttrs (break {}), and mapAttrs f (break {}) always errors out, complaining about about the argument being a thunk and not a set), which means that it can potentially break (ha) a lot of code that relies on those. does that mean it'd be considered a breaking change to do that (is break even considered part of the language's stability contract?) (and from experience it has bitten me every time i use break, to the point that i carry the declaration brk = x: builtins.seq (break x) x in every file i debug) Can you paste the errors maybe? | 23:29:49 |
zoë (she/her) | me too, but i don't know how the evaluator actually works internally, and i saw that trace has a forceValue(args[1]), and i know for a fact that trace doesn't have that bug, so i figured it'd fix it | 23:29:57 |
zoë (she/her) | sure hold on | 23:30:01 |
piegames | I have a hunch this might be a callsite problem | 23:30:14 |
piegames | In reply to @blokyk:matrix.org me too, but i don't know how the evaluator actually works internally, and i saw that trace has a forceValue(args[1]), and i know for a fact that trace doesn't have that bug, so i figured it'd fix it I mean you can just try it out and see if it helps | 23:30:42 |
zoë (she/her) | nix-repl> builtins.mapAttrs (n: v: v) (break { a = 5; })
error:
… while calling the 'mapAttrs' builtin
at «string»:1:1:
1| builtins.mapAttrs (n: v: v) (break { a = 5; })
| ^
… while evaluating the second argument passed to builtins.mapAttrs
error: expected a set but found a thunk: «thunk»
| 23:31:43 |
zoë (she/her) | yep that's what i did and it seems to work how i'd expect (i.e. the above expression evaluates fine) | 23:32:40 |
piegames | And if you replace break with identity or with trace it works? | 23:32:56 |
zoë (she/her) | it seems to be the case with most of the builtins i've tried, from memory | 23:33:13 |
zoë (she/her) | yep | 23:33:18 |
zoë (she/her) | nix-repl> builtins.mapAttrs (n: v: v) (builtins.trace "hi" { a = 5; })
trace: hi
{ a = 5; }
| 23:33:40 |
zoë (she/her) | * it seems to be the case with most of the builtins i've tried, from memory, which is why i starting looking at prim_break first | 23:34:13 |
zoë (she/her) | to me the most dangerous part is this, cause it's a lot more silent:
nix-repl> builtins.isAttrs (builtins.trace "hi" { a = 5; })
trace: hi
true
nix-repl> builtins.isAttrs (break { a = 5; })
false
| 23:35:15 |
zoë (she/her) | another fun one is this :D
nix-repl> builtins.map (x: x) (break [])
[ ]
nix-repl> builtins.map (x: x) (break [ 5 ])
error:
… while calling the 'map' builtin
at «string»:1:1:
1| builtins.map (x: x) (break [ 5 ])
| ^
… while evaluating the second argument passed to builtins.map
error: expected a list but found a thunk: «thunk»
| 23:36:31 |
piegames | Yeah okay | 23:37:17 |
piegames | Can you please open an issue with all of this? | 23:37:28 |
zoë (she/her) | sure | 23:37:39 |
piegames | But also you are right that a forceValue is missing in the primop | 23:37:42 |
zoë (she/her) | i wasn't sure how widely known this was, since i encountered it all the time (on both cppnix and lix) | 23:38:29 |
piegames | The reason being, that there is some undocumented invariant spread across the evaluator as to when a value is alloeed to be thunked. And break currently violates that, which is why forceValue on a break does not the right thing | 23:38:54 |
piegames | In reply to @blokyk:matrix.org i wasn't sure how widely known this was, since i encountered it all the time (on both cppnix and lix) I think you may be the single most active user of the debug REPL, maybe ever | 23:39:41 |
zoë (she/her) | xD | 23:39:50 |
zoë (she/her) | i don't even use it that much ;-; it does pain me how unknown and somewhat uncared-for it is ;-; | 23:40:21 |
zoë (she/her) | * i don't even use it that much ;-; it does pain me how unknown and somewhat uncared-for it is ._. | 23:40:24 |
piegames | To be frank it shouldn't exist in its current form in the first place | 23:40:59 |
piegames | It is uncared for because touching it is exceptionally unforgiving, and it is unknown because nobody bothered documenting a hacky half-working feature | 23:42:26 |
zoë (she/her) | done! would you want me to make a CL for this that simply adds forceValue (+changes the tests)? | 23:57:50 |
| 21 Mar 2026 |
zoë (she/her) | * done! would you want me to make a CL for this that simply adds forceValue (+changes the tests)? | 00:00:45 |
zoë (she/her) | * done! so would a CL for this that simply adds forceValue (+changes the tests) be ok? | 00:01:04 |
emily | that's not valid in all the cases multiline strings are | 03:17:48 |