Move jets documentation inside compiler#251
Move jets documentation inside compiler#251gerau wants to merge 6 commits intoBlockstreamResearch:masterfrom
Conversation
stringhandler
left a comment
There was a problem hiding this comment.
utACK 99425de
Some minor comments
src/docs/jet.rs
Outdated
| Elements::Some32 => "Check if a 32-bit value is nonzero.", | ||
| Elements::Some64 => "Check if a 64-bit value is nonzero.", | ||
| Elements::Verify => r#"Assert that a bit is true. | ||
| Elements::Verify => r#"**Deprecated; do not use.** Assert that a bit is true. |
There was a problem hiding this comment.
It actually doesn't exist anymore. I'm not sure of the history of this
There was a problem hiding this comment.
I think it does exist in low-level Simplicity but there is some reason that I don't quite understand that it's not mapped into SimplicityHL.
KyrylR
left a comment
There was a problem hiding this comment.
Verify and CheckSigVerify are uncategorized, so docs are not generated, is it Ok?
codegen/README.md
Outdated
| - "haskell_name" -- The name of the jet used in the Haskell and Rust code. | ||
| - "simplicityhl_name" -- The name of the jet as it is used in SimplicityHL. | ||
| - "section" -- The category to which the jet belongs. | ||
| - "input_type" -- The input type represented as an `AliasedType` in SimplicityHL. |
There was a problem hiding this comment.
It is actually a Vector:
input_type: simplicityhl::jet::source_type(jet)
.iter()
.map(|ty| ty.to_string())
.collect::<Vec<_>>()
.join(", "),
I'm not sure what to do with them, because we cannot call this jets from SimplicityHL code (source: Lines 1297 to 1299 in 682d829 Verify jet is actually the same as assert! (SimplicityHL/src/compile/mod.rs Lines 412 to 415 in 682d829 |
b49022b to
653c4d7
Compare
I think it is fine, because these jets are only accessible from Simplicity, and not SimplicityHL, but I would also like to hear @schoen's opinion about that as well. |
This moves jet documentation out of `codegen` crate into `SimplicityHL`, and gates it behind `documentation` feature.
This sync changes from `simplicity-lang-org` and fixes several typos. Also adds `Verify` and `CheckSigVerify` to categories.
This makes `codegen` binary work with two subcommands: - `modules`: generates rust modules, as previous implementation (with optional --out-dir flag to define folder in which code would generate) - `docs`: generates json file with jet documentation.
b09c61b to
d00ae35
Compare
|
Also could you align with @schoen So if this PR is merged this should be fixed as well, as this a breaking change we should document it |
|
@KyrylR I have already spoken to @gerau about the structure of the JSON and I'm not concerned about that problem (I plan to update the Python script). It is true that this is a breaking change but currently that Python script doesn't run automatically, only manually. Related: BlockstreamResearch/simplicity-lang-org#42 Basically, I'll have to do several things to take advantage of the work in this PR for the website, and I'm aware of the need to do them. |
I'd like to learn more about the history of the underlying issue, but from the point of SimplicityHL documentation, I think we should not generate docs for these jets because we can't call them from SimplicityHL, so from the point of view of SimplicityHL developers right now, it's essentially as if they don't exist in the language. This might be a minor point suggesting that there could someday be separate documentation generated for Simplicity and for SimplicityHL, but I don't think we need to worry about that right now. |
Right now we have 3 different sources in which we are getting information about Jet: LSP,
codegencrate (which would generate modules for SimplicityHL-as-Rust) and simplicity-lang-org.This PR moves Jet documentation from
codegencrate to SimplicityHL compiler, which is gated behinddocsfeature. Also, I had addedcodegenexecutable to be distributed alongside withsimplicityhlcrate, also gated behinddocsfeature. This executable supports old behavior of generating modules, and also extends to generating JSON file with jet documentation (see BlockstreamResearch/simplicity-lang-org#42 for more context). There are launch instructions in codegen/README.md.In future, I would like to add
JetInfoas a trait forJet, after this issue resolved, so it could also load in runtime jets documentation.