Skip to content

Instantly share code, notes, and snippets.

@EduardoRFS
Created April 5, 2020 19:07
Show Gist options
  • Save EduardoRFS/f9f71b6467ce74e13e0e32c049071da2 to your computer and use it in GitHub Desktop.
Save EduardoRFS/f9f71b6467ce74e13e0e32c049071da2 to your computer and use it in GitHub Desktop.

Recursion

This document should describe what should be the behavior when we have recursive dependencies.

Motivations

// TODO: Why is this useful. As seen in harfbuzz and freetype2 on runtime and for general recursion you can look at most compilers.

Runtime Recursion

Runtime Recursion means a case where two dependencies or more, recursively depends on each other, only on runtime, harfubzz and freetype2 is an example of this.

Solution

As we can describe non inclusive dependencies, we can say easily

  • A depends on B but is not inclusive
  • B depends on A but is not inclusive

Example:

  • harfbuzz depends freetype2 but doesn't depends on freetype2 dependencies

This is also the case for any command, where you're not building the package itself

General Recursion

General Recursion means a case where a dependencies endsup depending on itself recursively and you cannot escape it easily, it happens mostly during build.

TODO: find examples and think about how to solve it, probably ocaml itself

Self build recursion

// TODO describe that Classic compiler bootstrap should be good.

Mutually build recursion

How could we bootstrap this case?

  • A1, no deps
  • B1, deps A1
  • A2 provides A1, depends on B1
  • B2 provides B1, depends on A2

Solutions

Both solutions needs to be implemented to have it without any compromise

Compiling everyhintg

Pros:

  • reproducible
  • can be used on new platforms

Cons:

  • needs to build every dependency
  • package author needs to describe it
  • REALLY SLOW

Prebuilt

Pros:

  • easily solved
  • fast

Cons:

  • not reproducible
  • not useful for new platforms

TODO:

  • think about cases where you have three or more dependencies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment