essential-contributions / pint

Pint, the constraint-based programming language for declarative blockchains
Apache License 2.0
17 stars 4 forks source link

Optimizations around `let` variables #946

Open mohammadfawaz opened 6 days ago

mohammadfawaz commented 6 days ago

In the future, we want do more involved things such as removing unnecessary lets (const folding, DCE, etc.). That is, those variables don't necessarily need a state program. So, someone could write:

let x = 5;
let y = storage::y + x;

the first let shouldn't need a state program while the second should.

mohammadfawaz commented 4 days ago

After constant folding, the above should become:

let y = storage::y + 5;