algebra icon indicating copy to clipboard operation
algebra copied to clipboard

End glob imports

Open jon-chuang opened this issue 5 years ago • 0 comments

Personally, I find glob imports/reexporting in the root crate irksome.

For instance, ff::fields::* is glob imported. It is rather annoying to have inconsistent import practices, so that one can write ff::BigInteger and ff::biginteger::BigInteger. So, I recommend to choose one or the other.

If we want to enforce one or the other, one should either do pub mod xx; or mod xx; with pub use xx::*;

Since we are already exposing prelude, I recommend to remove glob imports entirely, and enforce that the ::xx:: has to be in the path if accessing infrequent methods not contained in prelude.


One could possibly write a bash script to do this import replacement once we stabilise what ought to be in prelude. One should match whatever is in prelude, and if the thing following :: is not in prelude, it must be imported through the module, so the module path ::xx would be inserted. Alternately, if the thing is in the prelude, the module path should change to e.g. ff::prelude::Thing;, rather than follow the module path, or perhaps to simply glob import the prelude, e.g. use ff::prelude::*.

jon-chuang avatar Nov 17 '20 10:11 jon-chuang