For instance, one could write "is_installed(X11) :- is_installed (KDE)" to specify that X11 must be installed if KDE is installed.
For instance, one could write "is_installed(X11) :- is_installed (KDE)" to specify that X11 must be installed if KDE is installed.
As a thought experiment:
- Let distros, package maintainers, repository maintainers and the guy building define boolean flags (like "UNIX", "Linux", "ARM", "ARMv7h", "x86", "x86_64", "POSIX_Filesystem", "GCC", "Clang", "C++11", "C++14"... anything you could think of). The latter override earlier definitions (in the order above, i.e. build > repo > distro). Allow the deriving of flags for simplification: "ARMv7h -> ARM", "Windows && ARM -> Use_some_WinRT_Hack" etc.
- Use a Prolog-Like system in which you can state rules for internal flags deciding if/which files should be included. Same goes for compiler flags.
- Add an option to add definitions for external projects that can be included automatically from their sources/binaries (using the same system; like Meson does).
- Just implement the "download/bootstrap" part and the logic solver. Generate ninja or tup files.
That should make an interesting build system. Of course, the maintaining of source file dependencies (which can be dynamic due to header files) and the versioning of libraries would still be problems that are not easy to solve. But at least, one could get rid of the mess that is pretty much every CMake build there is.
http://www.redditmirror.cc/cache/websites/web.archive.org_84...
(actually, parsing is one of the things i really love about Prolog. Writing a simple grammars is much easier and much more pleasurable than using things like regular expressions. The fact that it's far more powerful and readable is just a bonus. )
It's functional and not logic though:
But Nix is certainly an improvement over traditional, imperative package management.
Lots of the little DSLs used are in fact the descriptive abstractions you mention.
If not, it's quite easy to implement Prolog or any other logic language like Kanren in Scheme. It's been done many times.
Turing-complete package metadata has some obvious disadvantages too.
(edit: incidentally, I've also had the same thought about CSS selectors.)