!9IQChSjwSHXPPWTa:lix.systems

Lix

1124 Members
Lix user channel. Feel free to discuss on-topic issues here and give each other help. For matrix.to links to the rest of the Lix channels, see: https://wiki.lix.systems/books/lix-organisation/page/matrix-rooms311 Servers

Load older messages


SenderMessageTime
20 Mar 2026
@piegames:flausch.socialpiegames
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
@blokyk:matrix.orgzoë (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
@blokyk:matrix.orgzoë (she/her)sure hold on23:30:01
@piegames:flausch.socialpiegamesI have a hunch this might be a callsite problem23:30:14
@piegames:flausch.socialpiegames
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
@blokyk:matrix.orgzoë (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
@blokyk:matrix.orgzoë (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:flausch.socialpiegamesAnd if you replace break with identity or with trace it works?23:32:56
@blokyk:matrix.orgzoë (she/her)it seems to be the case with most of the builtins i've tried, from memory23:33:13
@blokyk:matrix.orgzoë (she/her)yep23:33:18
@blokyk:matrix.orgzoë (she/her)
nix-repl> builtins.mapAttrs (n: v: v) (builtins.trace "hi" { a = 5; })
trace: hi
{ a = 5; }
23:33:40
@blokyk:matrix.orgzoë (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
@blokyk:matrix.orgzoë (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
@blokyk:matrix.orgzoë (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:flausch.socialpiegamesYeah okay23:37:17
@piegames:flausch.socialpiegamesCan you please open an issue with all of this?23:37:28
@blokyk:matrix.orgzoë (she/her)sure23:37:39
@piegames:flausch.socialpiegamesBut also you are right that a forceValue is missing in the primop23:37:42
@blokyk:matrix.orgzoë (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:flausch.socialpiegamesThe 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 thing23:38:54
@piegames:flausch.socialpiegames
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
@blokyk:matrix.orgzoë (she/her)xD23:39:50
@blokyk:matrix.orgzoë (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
@blokyk:matrix.orgzoë (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:flausch.socialpiegamesTo be frank it shouldn't exist in its current form in the first place23:40:59
@piegames:flausch.socialpiegamesIt is uncared for because touching it is exceptionally unforgiving, and it is unknown because nobody bothered documenting a hacky half-working feature23:42:26
@blokyk:matrix.orgzoë (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
@blokyk:matrix.orgzoë (she/her) * done! would you want me to make a CL for this that simply adds forceValue (+changes the tests)? 00:00:45
@blokyk:matrix.orgzoë (she/her) * done! so would a CL for this that simply adds forceValue (+changes the tests) be ok? 00:01:04
@emilazy:matrix.orgemilythat's not valid in all the cases multiline strings are03:17:48

Show newer messages


Back to Room ListRoom Version: 10