kindelia / Kindelia

An efficient, secure cryptocomputer
https://kindelia.org/
603 stars 39 forks source link

checking arity for non-defined functions and ctrs #177

Closed o-santi closed 2 years ago

o-santi commented 2 years ago

checking if function/constructor is defined when reading their arity. creating new runtime error CtrOrFunNotDefined (name subject to change). some places should never return none (and there should be some way to read without unwrapping, but this will suffice for now.

steinerkelvin commented 2 years ago

and there should be some way to read without unwrapping

good luck with that wihtout introducing formal proofs on Rust, heh.

thank you santi.

steinerkelvin commented 2 years ago

actually, we could introduce some kind of "pointer to memory" in such a way that when we mach on it would contain a name that always safely resolve to an arity, on the context of some runtime.

let ptr = rt.get(loc);
match ptr {
  Fun(fun) => fun.arity()
  Ctr(ctr) => ctr.arity()
}

but it's just a vague ideia.