✨ Add basic library functionality#238
✨ Add basic library functionality#238LesterEvSe wants to merge 5 commits intoBlockstreamResearch:masterfrom
Conversation
1939b43 to
640a195
Compare
src/parse.rs
Outdated
| #[derive(Clone, Debug, PartialEq, Eq, Hash)] | ||
| #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] | ||
| pub enum Visibility { | ||
| Public, | ||
| Private, | ||
| } |
There was a problem hiding this comment.
| #[derive(Clone, Debug, PartialEq, Eq, Hash)] | |
| #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] | |
| pub enum Visibility { | |
| Public, | |
| Private, | |
| } | |
| #[derive(Clone, Debug, PartialEq, Eq, Hash, Default)] | |
| #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] | |
| pub enum Visibility { | |
| Public, | |
| #[default] | |
| Private, | |
| } |
45456e9 to
71daba0
Compare
71daba0 to
125177d
Compare
2d983a2 to
99bff73
Compare
|
@KyrylR please re-review |
|
99bff73 needs rebase |
99bff73 to
a69d210
Compare
- Refactor AST to include tests and modules - Add simple tests for module flow
a69d210 to
3dd5f03
Compare
Sure, on it, though it will take time, as its quite a big feature |
stringhandler
left a comment
There was a problem hiding this comment.
I'm sorry I've taken so long to review this. I do like the concept and the driver.
I would like to suggest these changes:
- I suggest we distinguish between local modules and package manager includes. There is no package manager at the moment, but there may be one in future.
For local files I suggest requiring themodkeyword in the entry point file for files that need to be included. Then I suggest we introduce acrate-like keyword for referencing items that are local to the project (in the same package).
// main.simf
mod math;
// reference the math mod inside this package
use crate::math::simple_op::hash;
// versus
// reference the math package from a package manager
use math::simple_op::hash;
- I suggest we pre-emptively choose a name for
simplicityhlpackages and create aCargo.tomllike package description now. Working with the symphony idea, perhaps I can suggestpart,motif,movementfor thecratereplacement, andcomposer,orchestrate,arrangefor theCargoreplacement.
This is where we ask the question: Should this happen here or in simplex, which also has asimplex.toml? Rustc and Cargo have different roles, but I would argue that the case here is different. To my knowledge,rustccompiles individual files or mods and then they are linked. We are not linking after compile, but rather before analysis in the AST. So I would suggest that the package definition (cargo.toml) should be the responsibility ofsimcand notsimplex.
That said, perhaps
smplxcan have the role of package manager in future and allow downloading packages (crates) from repositories.
| //! 1. **Publishing:** Create a Rust library (`cargo new --lib`), and place | ||
| //! your `.simf` files inside it. Then publish the crate to `crates.io`. | ||
| //! | ||
| //! 2. **Downloading:** In the consuming Rust project, add the published crate to |
There was a problem hiding this comment.
I am not a fan of this approach. The registry can be cleaned at any time.
Do we even need to suggest a way of doing this?
There was a problem hiding this comment.
if we are going to suggest, I would suggest using git clone or http download
There was a problem hiding this comment.
Okay, I can either add an additional approach using Git Clone and emphasise that it is basic, or I can simply replace it entirely. I prefer the first approach. What do you think?
This is a question for @KyrylR, too.
There was a problem hiding this comment.
I would say, don't recommend any method for downloading, let the user decide.
| //! | ||
| //! ## Distributing via npm | ||
| //! | ||
| //! NPM can also be used as a simple file delivery system for SimplicityHL, |
There was a problem hiding this comment.
This also seems more complicated than using git or http
I will answer the second question right away. Based on this Simplex issue #38, we assume that the load functionality will be in Simplex. |
Thanks for your review! :) Could you open an issue and detail your proposed approach for the |
|
Thanks, I will open an issue. I would say that this should be resolved before we merge this though, because otherwise there will be conflicting meanings in future. For example, if we merge this pr as is, then In order to not incur massive changes to this PR, maybe we can settle on always requiring I personally don't like |
Hmm, okay, that makes sense. I will think about the best way to implement it |
Added
useandpubkeywords.--depflag to load external libraries.driverdirectory to resolve external libraries.driverdirectory.Updated
Change the
ast.rsfile in accordance with the changes mention above.