-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API issues #35
Comments
Thanks Mario!
Yes, they indeed are debugging tools. Ok with that change for
Fix in #34
Fix in #34
Fix in #34
Actually is it just as (un)stable as the rest, and I've also used it in a toy dependent project. I'd say we keep it like that! :-) For the rest - some of them would be included in an API revamp around |
Fix in #56
The output of |
It is used in What's your opinion, @digama0 ? |
Yes but are the names and the messages in |
Well yes, it is unsound but convenient so I'm not surprised it is used. To avoid breakage, I think it would be fine to replace the existing
Not quite; the main purpose of the docs on the variants would be to explain what the arguments to the variants are. Beyond that, copying the first line "short" message from the error report is probably sufficient. |
Actually the definition of /// Transmutes this token into a Rust string.
#[must_use]
pub fn as_str(ptr: TokenPtr<'_>) -> &str {
std::str::from_utf8(ptr).expect("TokenPtr is supposed to be UTF8")
} So it is not unsafe. It'd rather the other way around: it might be an optimization to use
Ok, agreed. |
@tirix Oh, if that is |
This is a collection of issues I notice while looking at the docs.
Database
has a new method which takes aDbOptions
which implementsDefault
, butDatabase
doesn't implDefault
.DbOptions
actually correct?Database::parse
has a complicated input type. The desired flexibility is better accommodated with animpl FileResolver
, and it should have a basic API that takes animpl Read
orimpl BufRead
.Database::parse_result
is a public method that returns a private object.Nameset::update
shouldn't be public? It can't be called fromDatabase::name_result
.LookupLabel
, then pull out the label and... do something undocumented that depends onSegmentSet
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 animpl Write
rather than opening a file itself, and statements should be identified in a uniform way, e.g. byStatementAddress
rather than using&str
,Token
,Atom
,StatementAddress
andStatementRef
depending on the function.Database::statement
andDatabase::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 animpl 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 forannotate_snippets::snippet::Snippet
Executor
should not be public. Also, why is there an async implementation in this crate? Usesmol
or something.export::export_mmp
should not be public, it should be a function onDatabase
.Formula::display
should not produce a string, it should be an object implementingDisplay
. That object could beFormulaRef<'_>
which bundles together the formula and references into theDatabase
, so thatFormula::iter
can also be supported.Substitutions
implementsIndex<&Label>
, which uses an unnecessary indirection sinceLabel
is a 4 byteCopy
type.Formula::build_syntax_proof
has an unusedA
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.StatementRef
s. 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 privateOutlineNode::get_name
is unsound becauseOutlineNode::name
is publicProofTree
is not stand-alone, it requiresProofTreeArray
, so it should probably be exposed asProofTreeRef
retaining a reference to the arrayProofTreePrinter
has too many public fieldsVerifyExpr
should not be publicFrame
has too many public fields, and in particularoptional_dv
is public but has a private typeutil
should not be publicProofBuilder::build
has a complicated typefilename
,fnv
andregex
being re-exported? I don't see any need to do thisThe text was updated successfully, but these errors were encountered: