Skip to content

Recommended Practice

Yuki Kimoto edited this page May 17, 2024 · 4 revisions

Explains recommended practice.

The type of a boolean field.

A boolean field that stores 1 or 0 can represented by byte type, int type, or Bool class.

# Recommened
has flag : byte;

# Not recommened
has flag : int;

# Not recommened
has flag : Bool;

byte type is recommended.

The reason is that byte type is smaller and classes contained in SPVM distribution are writen as the same practice.

And Bool class is originally added to represent JSON boolean type for data serialization.