noname icon indicating copy to clipboard operation
noname copied to clipboard

can we get rid of the `const` keyword?

Open mimoo opened this issue 1 year ago • 2 comments

check the iterate.no example:

fn House.room(self, const idx: Field) -> Room {
    return self.rooms[idx];
}

do we really need the const here? Can't we just have the compiler complain if you pass a variable instead of a const for an actual circuit? It feels to me like this keyword just adds more mental load to the developer

(I did document the decision back then)

mimoo avatar Mar 25 '24 10:03 mimoo

in my notes I had "replace const Field with Number or Int or smthg"

mimoo avatar Mar 26 '24 14:03 mimoo

I think the const keyword is acting like a generic right now, which is nicer than having an extra syntax like fn House.room[idx](self) IMO

mimoo avatar Jun 01 '24 14:06 mimoo