regarding to Tact book constants documentation, it defined a non-friendly way to use the Enum concepts in Tact.
developers should define multiple constants instead of an enum, this way has some problem:
the defined constants to use instead of enums do not have a group:
it means if we have to define an enum for the status of a user we should do this for now:
const activeUser: Int = 0;
const blockUser: Int = 1;
const deletedUser: Int = 2;
there is no consistency in naming and grouping.
maybe it be better to do this like it(just syntax sample):
type consistency:
based on the above example from the tact book it is a mistake potential to use constant instead of
enum for types, for example:
const activeUser: Int = 0;
const blockUser: string = "1";
const deletedUser: Int = 2;
Let's consider a solution for the mentioned problem by defining an enum type for tact and the tact compiler to make the tact language more developer-friendly. We can take inspiration from other languages, such as TypeScript, which changed the syntax and defined the enum type, while Golang used const in a grouping manner. There are various ways to implement this, and we should have a detailed discussion about the implementation of this feature in this issue.
regarding to
Tact
book constants documentation, it defined a non-friendly way to use theEnum
concepts in Tact. developers should define multiple constants instead of an enum, this way has some problem:the defined constants to use instead of enums do not have a group: it means if we have to define an enum for the status of a user we should do this for now:
there is no consistency in naming and grouping. maybe it be better to do this like it(just syntax sample):
or
type consistency: based on the above example from the tact book it is a mistake potential to use constant instead of enum for types, for example:
Let's consider a solution for the mentioned problem by defining an
enum
type for tact and the tact compiler to make the tact language more developer-friendly. We can take inspiration from other languages, such as TypeScript, which changed the syntax and defined the enum type, while Golang usedconst
in a grouping manner. There are various ways to implement this, and we should have a detailed discussion about the implementation of this feature in this issue.