Replies: 5 comments 9 replies
-
Edit: posted this in the wrong place, moved to #2490 |
Beta Was this translation helpful? Give feedback.
-
I think this is a good idea. I would suggested keeping the library in the root under the current name and move the binary to a scryer-prolog-cli package but with the same binary name, that should prevent most links from breaking and keep the cli interface the same other that for cargo install one would now need to install scryer-prolog-cli instead of scryer-prolog. This might also help with #2336 |
Beta Was this translation helpful? Give feedback.
-
Back at a PC so I will now respond in more detail.
I think it would be good to fix this either way to have macros refere to themselves and other items/macros via
As I said in another comment this might also help resolve the warning in #2336 that the scryer-prolog library and executable end up with the same debug symbol file filename.
👍
👍 [workspace]
members = ["crates/*"] instead of having to list them one-by-one. I name the folder crates rather than packages as most are confused about/don't know the difference and I usually only have only one crate per package.
I don't think the split between lib and core is worth it as we would need to have core expose internal that lib uses instead of keeping them internal in one crate. Basically don't expose the internal core -> lib interface at all by keeping them in one library.
I know -sys is used for rust bindings of c-libraries i.e. crates that define the
We don't need to specify default-members if we only have one binary in the workspace.
I think the package
The main one that I know of that currently has problems with workspaces is
At least you can't forget to publish a dependency as crates.io enforces that you can't push a package with un-met dependencies
I think its common to have a -cli package for the cli.
I would agree.
We probably want a separate interface that we can annotate with |
Beta Was this translation helpful? Give feedback.
-
Thank you a lot for this overview and the many useful suggestions and considerations! I second the suggestion to take the input of @mthom into account especially for synchronizing all proposed changes with developments that are currently ongoing. It is my understanding that extensive changes are pending and it would be great to base all further developments on the latest improvements once they are published. The only remaining suggestion I have is that, if possible, the existing |
Beta Was this translation helpful? Give feedback.
-
I made a draft PR for solving visibility with the approach of removing the |
Beta Was this translation helpful? Give feedback.
-
(Continuing from #2465 (comment), split to discussion because that PR is already too long and this is relevant to other parts of Scryer Prolog)
This is the obvious thing to do actually, but I think we should maybe go even further. I was trying to deal with the issue of visibility for the Rust library interface (see #2490) and I got stuck because of the extensive use of
#[macro_use]
in Scryer Prolog. That makes a lot of macros that we probably want to be private (likeatom!()
) to be public (and global!) without a good way to turn it off. I was turning removing every#[macro_use]
and doing manual imports instead, but that is a lot of work and a lot of the code depends heavily on these macros being globally public.Unrelated to that (but also relevant to splitting crates), cargo does versions per package, and not per crate. A package can have multiple crates, and that is what Scryer Prolog does currently. We have a lib and a bin crate in the same
scryer-prolog
package. This means that they have the same version, which I don't think makes much sense. If we decide to rename something in the public interface in the library side it would be a breaking change and need a major version for crates.io, but then the binary would also get a major version even though that change was completely irrelevant. The converse can also happen. I've pondered a bit about that, and I think the path of least resistance with most gain is to do the following:scryer-prolog-core
. Ideally we would have a flat workspace where every package has equal status in the workspace, but there were concerns of invalidating current links to the source code the previous time we tried something like that1. Doing it like this, most of the code (including the Prolog libraries) would stay where it is.scryer-prolog-lib
would depend onscryer-prolog-core
and have the current Rust library interface. This would easily resolve the visibility issues and give more semver freedom for both packages.scryer-prolog-wasm
2 andscryer-prolog-sys
(calling C interface crates-sys
seems to be a convention for Rust) would depend onscryer-prolog-lib
(notscryer-prolog-core
) and contain the Wasm and C interfaces respectively.scryer-prolog-bin
could probably also just depend onscryer-prolog-lib
if we do it right, and would contain the binary (and probably literally just 5 lines of code). If we put it in thedefault-members
field we could evencargo run
in the workspace without specifying this package and it would just work as it does now.I'm not sure which of
scryer-prolog-bin
andscryer-prolog-lib
should keep the blessedscryer-prolog
package name. I feel that the binary keeping the name makes a bit more sense.#[macro_rules]
.scryer-prolog-core
further for compilation times and memory usage in the future if we decide to do that.-p <package>
for some commands.scryer-prolog
package on crates.io lose either the binary or the library, as it currently provides both.Pinging because you were in the PR thread and will probably want to comment on this @Skgland @jjtolton @triska
Footnotes
I personally think that it is worth it, but it's not that big of a deal. If you link to a file on Github you should always use a permalink and/or make it clear that what you are saying is "at time of writing". If your non-permalink breaks it's kind of your fault. ↩
I think that with a good enough Rust interface we will not even need a separate wasm package actually, but I need to investigate this a bit more. ↩
Beta Was this translation helpful? Give feedback.
All reactions