Skip to main content
Tolk provides a standard library that evolved from FunC’s standard library. Therefore, many functions from stdlib.fc can be mapped to Tolk, and most of these functions were converted into methods.

Functions vs methods

Tolk supports declaring methods, including primitives. Consequently, many FunC global-scope functions are now methods, e.g., cell.hash(), tuple.size(), etc.
In FunC, x.f() works equally to f(x). For instance, someTuple.tuple_size() and tuple_size(someTuple). In Tolk, someTuple.size() is the only valid notation.

Renamed and removed functions

For load_xxx, store_xxx, and skip_xxx, use automatic serialization. Methods slice.loadXXX, builder.storeXXX, and slice.skipXXX are available for manual cell parsing, but their use is not recommended. For idict_xxx, udict_xxx, and dict_xxx, use native maps. Dictionaries remain available in the file @stdlib/tvm-dicts, but their is not recommended. Other functions: Lisp-style lists require an explicit import; IDEs usually add the import automatically.

Mutating functions

In FunC, x~method mutates, whereas x.method returns a copy. In Tolk, methods are called with dot . and may mutate the object.
  • If cs~load_uint(…) was used, cs.loadUint(…) behaves identically.
  • If cs.load_uint(…) was used to obtain a copy, a different approach is required.

Added functions

Tolk provides functions out of the box. The standard library is split into multiple files. Functions from common.tolk are always available, and most FunC analogues are included. Functions from other files must be explicitly imported: