You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
lets you introspect the function args of lambdas in pure eval: functionArg = fn: if builtins.isFunction fn then let m = builtins.match ''^.*<varpat[[:space:]]+name="([^"]+)"[[:space:]]+/>.*$'' (builtins.toXML fn); in if m == null then null else builtins.head m else null
let you get the name of @args variables, as well as the ellipsis flag for formal parameterized functions, which builtins.functionArgs cannot do (so we have created a weird API around that as well)
I'm not sure who actually uses it considering we have toJSON. I found one single usage in nixpkgs, in GRUB. That's rather unfortunate, but also could probably be adapted to not rely on it.
It lets you introspect Nix expressions, which may be useful, but feels more like a debug tool than something that we should be using.
As an example, noogle uses a C plugin for docs.
Proposed solution
Remove it completely. Some of this functionality seems like it should be used in plugins rather than being exposed to the evaluator.
Alternative solutions
Keep it and fix it, but add an eval warning for using it. Maybe even remove some of the things it can do to just allow serializing flat data, possibly so GRUB configs still work in old versions of nixpkgs.
Is your feature request related to a problem?
toXML has some surprises:
fixed now 👌let x = [ x ]; in builtins.toXML xblows the stack and crashes the interpreterfunctionArg = fn: if builtins.isFunction fn then let m = builtins.match ''^.*<varpat[[:space:]]+name="([^"]+)"[[:space:]]+/>.*$'' (builtins.toXML fn); in if m == null then null else builtins.head m else null@argsvariables, as well as the ellipsis flag for formal parameterized functions, which builtins.functionArgs cannot do (so we have created a weird API around that as well)I'm not sure who actually uses it considering we have toJSON.I found one single usage in nixpkgs, in GRUB. That's rather unfortunate, but also could probably be adapted to not rely on it.Proposed solution
Remove it completely. Some of this functionality seems like it should be used in plugins rather than being exposed to the evaluator.
Alternative solutions
Keep it and fix it, but add an eval warning for using it. Maybe even remove some of the things it can do to just allow serializing flat data, possibly so GRUB configs still work in old versions of nixpkgs.
Additional context
Checklist
Add 👍 to issues you find important.