Open 0kenx opened 1 month ago
Actually, Tact doesn't by default put nested A
in a Cell
, it puts it in a Slice
instead.
So the question becomes, a) is there a way to call the generated FunC function fun $A$_load(s: Slice): A
directly in Tact code? b) is there a way to force some data fields to go in their own Cell
s?
Following up on this, I suggest adding a Ref<struct | message>
type:
struct A {
a: Int;
}
struct B {
x: A; // stores A as Slice
y: Ref<A>; // stores A as Cell in a ref
Compilation error when types are defined recursively:
or
gives error
To circumvent this limitation, I currently define the struct as:
and translate the implementation of generated FunC
$A$_load(slice sc_0)
into Tact and loadb
using this function. Now after compilation I have 2 identical FunC functions:$Slice$_fun_load_a(slice $self)
and$A$_load(slice sc_0)
. Not sure whether this is optimized away in fift compilation or not.