4 ms·
> Nix's system of overlays depends on laziness too to provide efficient late-binding familiar from OOP. As an OOPer, inheritance is one of the things that is g
by joshka 4y ago
> Nix's system of overlays depends on laziness too to provide efficient late-binding familiar from OOP.
As an OOPer, inheritance is one of the things that is generally trotted out as the worst aspect of OO languages. This leads to the mantra "favor composition over inheritance". Much has been written about why and how. But it seems to cause the same pain points that people talk about with respect to laziness in Nix. "Spooky action at a distance" is one of my favorite ways of describing some of these problems.
(I'm not super familiar with Nix, so I could be misreading the points about laziness. Please forgive me if so.)
- rssoconnor 4y agoI actually agree with you about inheritance and OOP. It's funny because when I finally understood how to override packages with this late-binding technique, I said to myself "Finally I've found a use for inheritance!". I certainly think people should exercise caution as this could probably be abused quite badly. Maybe people will come up with better designs in the future. However I will say, that the method it has replaced was much worse. The old way was adhoc and almost always failed to achieve ones desires in all but the simplest cases. Don't just take my word for it. Peter Simons also agrees: <https://github.com/NixOS/nixpkgs/commit/3c8b33eee442fd573d47555122cfe358134aeb64 https://github.com/NixOS/nixpkgs/commit/3c8b33eee442fd573d47...>