noname icon indicating copy to clipboard operation
noname copied to clipboard

constant-size arrays

Open mimoo opened this issue 1 year ago • 3 comments

const c_mul = 2;

fn main() -> [Field; 3 * c_mul + 1] {
  return [1, 2, 3, 4, 5, 6, 7];
}

^ this example should compile. If it doesn't, we should ensure that it does :)

mimoo avatar Jul 09 '24 03:07 mimoo

this should be already supported in the const generic PR https://github.com/zksecurity/noname/pull/147

katat avatar Aug 23 '24 09:08 katat

maybe this issue should be about converting the current examples/const.no:

const player_one = 1;
const player_two = 2;

fn main(pub player: Field) -> Field {
    assert_eq(player_one, player);
    let next_player = player + 1;
    assert_eq(player_two, next_player);
    return next_player;
}

to something that uses const more? or adding another const example there

mimoo avatar Aug 23 '24 14:08 mimoo

Agreed. It makes sense to add an array example with const variable as its size.

katat avatar Aug 26 '24 07:08 katat