indygreg added a comment.

  Yes, we should definitely split things into multiple crates. Small, 
narrowly-focused crates does seem to be the Rust way, after all.
  
  `hgcli` should be for things specific to the Rust implementation of `hg`. I 
think this can also include the feature set of `chg` (once we've ported `chg` 
to Rust).
  
  I definitely support separating the "pure Rust" from the "Python Rust" via a 
crate boundary. It is generally useful to have Rust that isn't bound to Python 
because it will facilitate reuse outside of Python contexts. For example, 
someone could implement a Mercurial wire protocol server in pure Rust without 
needing to worry about Python. Of course, we're likely to encounter areas where 
we really want tight coupling in order to achieve optimal performance in 
Python. So we may have to design APIs on the pure Rust side to facilitate 
CPython use. I'm OK with that.
  
  As for how many crates to have, I don't have super strong opinions. I could 
see us putting every little component/subsystem in its own crate. I could also 
see us putting everything in one large crate. I don't think it is worth 
deciding at this early juncture. API design and ability to be reused outside 
its originally intended purpose is the important property to strive for. I 
think that has more to do with how the code is authored rather than which 
crates things are in.
  
  A missing piece of this patch is the build system and module loader 
integration. We have a //module policy// that dictates which implementation of 
a Python module we use. We probably want to introduce a `rust` policy that uses 
Rust-based modules where available and falls back to the `cext` modules/policy 
if a Rust module isn't available. We also need to figure out how to integrate 
Rust into `setup.py`. But I think the build system bit can be deferred until 
we're actually ready to ship Rust, which is still a bit of ways off. I'm happy 
for the workflow to be //run cargo in order to load Rust modules// for the time 
being. But if you can implement `Makefile` and/or `setup.py` integration to 
build these Rust extensions, that would be awesome.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2057

To: Ivzhh, #hg-reviewers
Cc: indygreg, durin42, kevincox, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to