-
Notifications
You must be signed in to change notification settings - Fork 134
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
Be conservative with visibility #2523
Conversation
I also want to ask @mthom if removing all of the |
OOOHH, I was confusing how things work. The issue is actually with |
Ok, I feel a bit stupid now by thinking that would be very hard. I just left all macros global (that's what Ok, now we already have a pretty small public interface that we can polish and document extensively: Now we have to decide what to about all the warnings (39 warnings, mostly about unused code). |
I fixed the warnings (and Clippy). I only deleted parts of code that really seemed useless or would be very easy to reimplement if we need in the future (which was most of the warnings actually). I think this is ready for review, the open questions can be decided in another PR. |
I don't have good answers to either of these questions I'm afraid. Most of the time it's a matter of wait and see. Looks good to me, unless there are objections or further requests. |
Part of #2490. Related previous discussion #2512. This PR does the following:
run_binary()
function in the library interface, so that we don't have to make stuff likeAtom
andatom!
public.pub
(and wasn't used in tests or benchmarks) intopub(crate)
(or stricter) instead. Maybe most of those could/should be even stricter, but this is out of scope because it would not be a breaking change if done after this PR.Currently the following are public (our semver surface) and
pub use
d at the top level of the library:Machine
new_lib
load_module_string
consult_module_string
run_query
run_query_iter
with_test_streams
(only used in integration tests)test_load_file
(only used in integration tests)test_load_string
(only used in Wasm build)get_inference_count
(only used in benchmarks)new
MachineConfig
#[non_exhaustive]
.in_memory
with_toplevel
QueryMatch
#[non_exhaustive]
.QueryState
QueryResolution
#[non_exhaustive]
QueryResolutionLine
#[non_exhaustive]
StreamConfig
#[non_exhaustive]
Value
#[non_exhaustive]
run_binary
QueryResult
cargo check
goes crazy with the amount of dead code warnings. It didn't point it before becausepub
code isn't considered in dead code analysis. Clippy goes even crazier, it seems to be linting the generated files now for some reason (which is good, but why didn't it do that before?). No errors in either though.Open questions
Can be addressed in another PR.
Machine
methods that are only used in tests, benchmarks and the Wasm build or should we refactor to use the rest of the interface instead so that we get a cleaner public interface?run_binary
be behind a feature?Remaining work
#[macro_use]
macros. I think all of them should probably be private, as they leak internal details and aren't really useful to users.This will be quite a chore, because Scryer Prolog seems to rely a lot on these macros being public and global.Was actually very easy.cargo check
(maybe by just#[allow(dead_code)]
ing most of it).Out of scope for this PR
#[non_exhaustive]
ing enums).