Two equality cases diverge from Nix. Both are in src/expr/vm/builtins/equality.zig.
A string compares equal to a path
$ fix eval --expr '"/a" == /a'
true
$ nix-instantiate --eval -E '"/a" == /a'
false
Nix compares types first, so a string is never equal to a path regardless of spelling.
A function compares equal to itself (equality.zig:105)
$ fix eval --expr 'let f = x: x; in f == f'
true
$ nix-instantiate --eval -E 'let f = x: x; in f == f'
false
Nix returns false for any comparison involving a function, including a value against itself — functions are simply never equal. Pointer identity is not part of the language semantics, and code that filters or dedupes a list of functions will behave differently on the two implementations.
fix 0.3.0 at 1f1a99cf, built -Doptimize=ReleaseSafe with Zig 0.16.0, darwin/aarch64. Reference implementation is Nix 2.34.8.
Two equality cases diverge from Nix. Both are in
src/expr/vm/builtins/equality.zig.A string compares equal to a path
Nix compares types first, so a string is never equal to a path regardless of spelling.
A function compares equal to itself (
equality.zig:105)Nix returns
falsefor any comparison involving a function, including a value against itself — functions are simply never equal. Pointer identity is not part of the language semantics, and code that filters or dedupes a list of functions will behave differently on the two implementations.fix 0.3.0 at
1f1a99cf, built-Doptimize=ReleaseSafewith Zig 0.16.0, darwin/aarch64. Reference implementation is Nix 2.34.8.