Skip to content

Add const keyword - #452

Open
LesterEvSe wants to merge 7 commits into
BlockstreamResearch:masterfrom
LesterEvSe:feat/const-item
Open

LesterEvSe wants to merge 7 commits into
BlockstreamResearch:masterfrom
LesterEvSe:feat/const-item

Conversation

@LesterEvSe

@LesterEvSe LesterEvSe commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Previously, this functionality was deleted in #323 along with the old mod keyword support, but the lexer and parser still support this. So now we reintroduce const.

The main reason we need it is to avoid using functions where a const would be enough. A simple example is the sha256_paddings.simf file in the price-oracle repo.

So now we can do something like this:

mod config {
    pub const FEE: u32 = 1_000;
}

use crate::config::FEE;

const MAX: u32 = 10_000;

fn main() {
    assert!(jet::lt_32(FEE, MAX));
}

NOTE: It's better to review this after #451 is merged.

Checklist

  • New or changed language features are used in fixtures/kitchen_sink.simf (see its header).

@LesterEvSe
LesterEvSe requested a review from KyrylR October 23, 2026 14:08
@LesterEvSe LesterEvSe self-assigned this Oct 23, 2026
@LesterEvSe LesterEvSe added the enhancement New feature or request label Oct 23, 2026
@LesterEvSe
LesterEvSe marked this pull request as ready for review October 23, 2026 15:43
@LesterEvSe
LesterEvSe requested a review from delta1 as a code owner October 23, 2026 15:43

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant