Skip to content

API issues #35

Open
Open
@digama0

Description

This is a collection of issues I notice while looking at the docs.

  • Database has a new method which takes a DbOptions which implements Default, but Database doesn't impl Default.
  • Is the default instance for DbOptions actually correct?
  • Database::parse has a complicated input type. The desired flexibility is better accommodated with an impl FileResolver, and it should have a basic API that takes an impl Read or impl BufRead.
  • Database::parse_result is a public method that returns a private object.
  • Nameset::update shouldn't be public? It can't be called from Database::name_result.
  • The nameset interface is too complicated. You map atoms to tokens, tokens to LookupLabel, then pull out the label and... do something undocumented that depends on SegmentSet to get a statement.
  • Frame is unrecognizable compared to the MM spec. Most of the fields probably shouldn't be public, and it should have an actual API for getting the bits out.
  • Diagnostic doesn't have docstrings for the variants.
  • Database::export should output to an impl Write rather than opening a file itself, and statements should be identified in a uniform way, e.g. by StatementAddress rather than using &str, Token, Atom, StatementAddress and StatementRef depending on the function.
  • Database::statement and Database::export shouldn't need to mutate the database.
  • Database::print_grammar, Database::print_formula etc. look like debugging tools, they shouldn't be in the public API. If they are, they should have a return value or write to an impl Write or something.
  • Database::diag_notations is a weird API. types could be a config struct with boolean fields, and the output could be provided by a callback to allow for incremental rendering and doing whatever the user wants to do with the diagnostics.
  • Notation could be swapped out for annotate_snippets::snippet::Snippet
  • Executor should not be public. Also, why is there an async implementation in this crate? Use smol or something.
  • export::export_mmp should not be public, it should be a function on Database.
  • Formula::display should not produce a string, it should be an object implementing Display. That object could be FormulaRef<'_> which bundles together the formula and references into the Database, so that Formula::iter can also be supported.
  • Substitutions implements Index<&Label>, which uses an unnecessary indirection since Label is a 4 byte Copy type.
  • Formula::build_syntax_proof has an unused A type parameter.
  • Grammar::parse_formula takes a &mut dyn Iterator but it could take &mut impl Iterator
  • outline says it is not stable, so it should probably not be public at all.
  • There should be a more strongly typed way to inspect StatementRefs. Not all statement kinds have all the data, and the API should be a guide to what has what.
  • parser has lots of public types that should not really be public, or should be public with private members.
  • parser::as_str is unsound and should at least be private
  • OutlineNode::get_name is unsound because OutlineNode::name is public
  • ProofTree is not stand-alone, it requires ProofTreeArray, so it should probably be exposed as ProofTreeRef retaining a reference to the array
  • ProofTreePrinter has too many public fields
  • VerifyExpr should not be public
  • Frame has too many public fields, and in particular optional_dv is public but has a private type
  • util should not be public
  • ProofBuilder::build has a complicated type
  • Why are filename, fnv and regex being re-exported? I don't see any need to do this

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions