kindelia / Kindelia

An efficient, secure cryptocomputer
https://kindelia.org/
609 stars 38 forks source link

Dirty constructor "flag" #233

Open steinerkelvin opened 2 years ago

steinerkelvin commented 2 years ago

A slightly different kind of constructor which acts like a function call: it reduces to itself and triggers further reduction on compute_at function.

It allows the user to signal that "this data has been recently created".

e.g.

(MyContract {Update}) =
  let x:xs = (Load);
  ask (Save {T2 (Inc x) xs});  // `Inc` inside of `T2` will not reduce when it's saved
  (Done #0)

(MyContract {Update}) =
  let x:xs = (Load);
  ask (Save {#T2 (Inc x) xs});  // `Inc` inside of `T2` will reduce when it's saved because `#T2` will be reduced itself
  (Done #0)

pub const DP0: u128 = 0x00;
pub const DP1: u128 = 0x01;
pub const VAR: u128 = 0x02;
pub const ARG: u128 = 0x03;
pub const ERA: u128 = 0x04;
pub const LAM: u128 = 0x05;
pub const APP: u128 = 0x06;
pub const SUP: u128 = 0x07;
pub const CTR: u128 = 0x08;
pub const CTS: u128 = 0x09;  // New memory cell / node
pub const FUN: u128 = 0x0A;
pub const OP2: u128 = 0x0B;
pub const NUM: u128 = 0x0C;
pub const NIL: u128 = 0x0F;