Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

Importing from the same crate #286

Open
rasmus-kirk opened this issue Aug 15, 2022 · 0 comments
Open

Importing from the same crate #286

rasmus-kirk opened this issue Aug 15, 2022 · 0 comments
Labels
bug 🐞 Something isn't working typechecker 👔

Comments

@rasmus-kirk
Copy link
Contributor

I have been working on implementing Bulletproofs in Hacspec, but the algorithm is fairly long. I would like to be able to split up a file into smaller bits. Take the following file structure as an example:

image

I have the three main files as errors.rs, ipp.rs and transcript.rs. Both errors.rs and the transcripts.rs file can easily be reached from the main ipp.rs file using:

mod transcript;
use transcript::*;

mod errors;
use errors::*;

But the transcript.rs file also needs access to the errors.rs file and the above code import would not work. This is also why in the example, there is two errors.rs files, the cursive is a symbolic link to the non-cursive. This does work but it is obviously not ideal.

Googling around how to solve the issue, the following is the accepted way to do it in pure Rust:

use crate::errors::*;

But this is not allowed in hacspec. Is there another way to do this, and if not, could hacspec support something like what was suggested for pure Rust?

@franziskuskiefer franziskuskiefer added bug 🐞 Something isn't working typechecker 👔 labels Sep 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug 🐞 Something isn't working typechecker 👔
Projects
None yet
Development

No branches or pull requests

2 participants