Open Pacman99 opened 1 year ago
That sounds like a bug indeed: the list of supers should be eagerly evaluated to resolve the multiple inheritance hierarchy, but the fields of the super itself shouldn't. Maybe the bug though isn't in the super handling, but in the casting of prototype-less record to pop prototype? Even then that would be a bug, but a different one.
Maybe the bug though isn't in the super handling, but in the casting of prototype-less record to pop prototype?
I dont think so, I just used the plain attribute set as an example, but it happens even if that attrset was wrapped in a kPop
.
pop.lib.pop { supers = [ (kPop { a = throw "err"; b = 5; }) ]; }
Also errors out.
@fare Are there any inquiries pertaining to this matter? I also got the same problem when I trying embed POP into my instance. Thanks
I opened this https://github.com/NixOS/nix/issues/8364
https://twitter.com/Ngnghm/status/1717684526720094339
Lacking the ability to compare structures or functions by pointer identity, or system-provided nonces as identity tags, the only reliable solution is user-provided labels with some naming conventions to retrieve some modularity.
Akshully, we might be able to do proper pointer equality: https://code.tvl.fyi/about/tvix/docs/value-pointer-equality.md
Yeah I just saw that thread! I might give that a try to see if we can fix this issue. I tried something similar with lists which sometimes worked, so hopefully this trick will work fully.
Note that one part of the problem is ensuring that true
is returned when the two are pointer-equal, the other part of the problem is ensuring that false
is returned when they are not, instead of an error being thrown or an infinite branch taken.
An attribute in a pop containing an error shouldn't error out the entire pop. Other attributes should still be accessible even if one attribute errors out.
The following code should print out
5
, but it would just error out now.cc @fare