Closed alexvanaxe107 closed 1 year ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Updated (UTC) |
---|---|---|---|
nixos-and-flakes-book | ✅ Ready (Inspect) | Visit Preview | Aug 2, 2023 3:56pm |
@alexvanaxe107 According to the nixpkgs's official docs https://nixos.org/manual/nixpkgs/stable/#sec-pkg-override, override
is indeed a function:
The function override is usually available for all the derivations in the nixpkgs expression (pkgs).
It is used to override the arguments passed to a function.
Of course, the override
function is an attribute of any derivation too.
I don't think this change is necessary, but thank you for your contribution anyway.
@alexvanaxe107 According to the nixpkgs's official docs https://nixos.org/manual/nixpkgs/stable/#sec-pkg-override,
override
is indeed a function:The function override is usually available for all the derivations in the nixpkgs expression (pkgs). It is used to override the arguments passed to a function.
Of course, the
override
function is an attribute of any derivation too. I don't think this change is necessary, but thank you for your contribution anyway.
No Problem. It is really ambiguous, and can be considered a function since It is an attribute that stores a function. The problem is that on nix, we don't call a function with name.function AFAIK, but name function (With space instead of dot).
In this guide he explains why it is an attribute and not a function/method. https://nixos.org/guides/nix-pills/override-design-pattern#id1430
But since in the official docs it treat as a method, I agree with you to let the way it is.
But thanks a lot for your book, it helps a lot newcomers.
In this guide he explains why it is an attribute and not a function/method. https://nixos.org/guides/nix-pills/override-design-pattern#id1430
Yeah, Nix Pills says:
Note: that
.override
is not a "method" in the OO sense as you may think. Nix is a functional language. That .override is simply an attribute of a set.
I think you may have mixed up the concepts of method
and function
, function
is just a general term suitable for any programming language.
According to Method (computer programming) - Wikipedia:
A method in object-oriented programming (OOP) is a procedure associated with an object, and generally also a message.
And https://en.wikipedia.org/wiki/Function_(computer_programming)
In computer programming, a function or subroutine is a sequence of program instructions that performs a specific task, packaged as a unit. This unit can then be used in programs wherever that particular task should be performed.
Generally speaking, it is not ambiguous for us to say that override
is a function
(but it will be a mistake to say override
is a method of a derivation).
The override is not a funcion. It is an attribute.