GithubHelp home page GithubHelp logo

redprl / bantorra Goto Github PK

View Code? Open in Web Editor NEW
17.0 17.0 0.0 924 KB

๐Ÿ“š A library for managing libraries and resolving unit paths

Home Page: https://redprl.org/bantorra/bantorra

License: Apache License 2.0

OCaml 100.00%
ocaml ocaml-library

bantorra's People

Contributors

dependabot[bot] avatar favonia avatar jonsterling avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

bantorra's Issues

Use Unix.realpath (via OCaml 4.13) and avoid Unix.chdir

Unix.chdir and Sys.getcwd are currently used to normalize file paths, but the stateful chdir becomes a major reason why bantorra is not thread-safe. It's possible to normalize file paths without chdir, but the code would be too ugly. Thankfully, OCaml 4.13 will bring in a real Unix.realpath that does the job. I believe with some locking the entire library can be made thread-safe. For these reasons we should switch to OCaml 4.13 as soon as it is officially released.

Update to current Asai

Bantorra appears to be using an outdated version of Asai, with Logger instead of Reporter.

Use JSON instead of YAML

YAML is beautiful but JSON is much more well-defined and well-implemented, especially in the area of implicit types. JSON has its own issues, for example duplicate keys, but overall it's easier to find quality encoders and decoders.

Eager checking

Currently, the library lazily loads libraries. This is bad and should be changed.

  1. There should be eager initialization that loads everything.
  2. However, once everything is loaded, the checking should done in the offline mode as in #73.

It is wrong to load libraries lazily because (1) there's no way to detect whether some library is bad and (2) there's no way to solve version constraints without loading everything.

UserConfig.write is unsafe

The module UserConfig cannot serialize library versions correctly because the underlying OCaml binding of libyaml is serializing the string "1.0" as the floating point 1., "null" as null (unquoted), etc. This means users have to manually edit the configuration files.

The bug report to the upstream: avsm/ocaml-yaml#39

[library resolver] local waypoints.

This is the spec of waypoints that point to local library roots. A library reference in this scheme is a string library.name. Waypoints are stored in YAML files of a name specified by the client. Maybe it's waypoint. This special file name is referred to as ${waypoint} below.

Direct waypoints

These are the basic waypoints pointing to the roots of libraries. The resolver will keep moving up in the file system until some matching waypoint is found. If the root directory is reached and there's still no matching waypoint, the resolution fails.

- "basis":
    at: ["src", "basis"]
- "frontend":
    at: ["src", "frontend"]

Indirect waypoints

Indirect waypoints delegate the resolution to other waypoints, which can also be indirect. The resolution is thus recursive. The library name must be explicitly listed in the next waypoint file. That is, it will not move up in the file system when no applicable waypoint is found. Otherwise, one can easily have unintentional infinite looping due to a typo.

- "bantorra":
    "next": ["mylib", "bantorra"] # the resolver will look up the library in "mylib/bantorra/${waypoint}"
- "cool.basis":
    "next": ["mylib", "cool"] # the resolver will look up the library in "mylib/cool/${waypoint}"
    "rename": "basis" # optional field for the new name to look up

Mixed waypoints

Of course, you can have both direct and indirect waypoints in a single file.

- "cool.basis":
    "next": ["mylib", "cool"]
    "rename": "basis"
- "bantorra":
    "next": ["mylib", "bantorra"]
- "builtin":
    "at": ["runtime", "builtin"]

Name uniqueness

The YAML format demands unique library names within a waypoint file, so there should not be any ambiguity. The order of waypoints in a file should not matter.

Unit remapping

It would be useful to introduce a mechanism for

  1. Private units only visible to a library, and
  2. Putting all code under a subdirectory (such as src/)

Grand rewrite plan

New plan: drop camlzip and LMDB.

  • Use ezgzip + ezjson and reimplement the compression later, if necessary.
  • Drop LMDB and write something inspired by bap-cache, except that GC is done by fuzzy LRU (like relatime). Unfortunately we cannot use bap-cache directly because it will pull in a prohibitively large dependency tree.
  • This library still intends to support using JSON everywhere.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.