-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tact 2.0 RFC #249
Comments
Couple of ideas:
|
Not sure here, as this will also influence fields (persistent state variables) in contracts and traits — they use semicolons in their declarations as of now |
It's fine, though. Syntactically it's included between a pair of curly braces, so there won't be any grammar conflicts. And there is a nice principle saying that declarations and definitions should resemble each other. And it makes it resemble TS more, which is what we target in terms of syntax |
Added a couple more bullet points:
|
|
|
|
We can use ast-grep, which uses Tree-sitter to perform AST-based search and replace. Additionally, it can lint code with the visually same error reports like Rust does, provided that we specify linting rules — this can be a starting point for our linters. Apart from CLI, it also has a Node.js binding |
@novusnota I was thinking we can have a tool that combines Tact v1 parser and Tact v2 code formatter: this way we can migrate contracts if we only have local syntactic changes. Plus we can do some more massaging of the original contract, like explicit map initializations. |
@anton-trunov Oh, so you want for code formatter to not only format, but also perform lint-like fixes? I thought of formatter purely in terms of whitespace fixing, and leaving the actual code replacements to the |
|
@novusnota Not at all, I was talking about creating a tool like |
Why? I have multiple use cases where I need to declare an empty map without adding any entries in init (eg. RBAC). |
Semantically nothing will be changed here, the user will have to just explicitly state the initial value for map. This part should be migrated automatically |
Any plans to revive this? https://github.com/tact-lang/docs-obsolete/blob/main/tact-design.md#interfaces I'd love to see |
Yep, we definitely need adhoc polymorphism in Tact |
Well, as |
Albeit it's just a suggestion — do we need a |
Regarning I'm not sure if that's a valid issue (need to gather community feedback here), but it may be beneficial to merge That way we could clarify things and make it simpler to read and write Tact code. And that would also alleviate the need to capitalize Messages/Structs in the docs to refer to the types and not to the communication itself :) |
I think the current definition of If we were to merge the two then what would become |
Maybe better to make like in Kotlin/JS/TS/PHP using |
Suggestion:Get rid of multi-line
Motivation:
|
Great suggestion! Looks like it's about time to move this issue to its own repo and continue discussions in separate issues there. Wdyt? |
Well, yeah, this can be moved to tact-lang/roadmap or to some more RFC-specific repo and then referenced from this issue |
We may try to add direct TVM assembly function wrappers, similar to how it can be done in FunC: RETALT example. This will remove the need to write them in FunC, and then import and wrap in a native function in Tact — we would just write assembly ourselves. Perhaps, it's best to add another attribute to native functions in Tact, so that we have
Syntax aspects are up to discussion though, not 100% sure how this should be arranged :) |
This is a very incomplete draft proposal for the next major version of Tact. Comments are most welcome.
Grammar
...
(or something else) -- useful for parsing incomplete examples in docs, where the triple dots mean "some code skipped";struct
,message
,contract
,init
,bounced
,external
,primitive
,map
, andreceive
,get
(or whatever we change those to) as identifiers and make those keywords, e.g.let struct: Int = 0
will become illegal;if
statement always have parentheses around its condition, or drop parens forwhile
,repeat
,do-until
;;
a statement separator, not a statement terminator, but allow;
for the last statement in a block;,
) should separate fields in in struct/message declarations to make it consistent with struct/message definitions;Int
type ascriptions for contract for storage variables: e.g.x : int32
instead ofx : Int as int32
;storage_var <- expression
;self
, for example,storage.var
(we might even want to hint at it syntactically withstorage { var : Type ... }
declaration inside a contract);{1: "foo", 2: "bar"}
), map access (map[key]
), map updates (map[key] = val
andmap[key] += inc
, etc.);map
type identifier:Map<K, V>
;==
/!=
which hides this fact. Switching to something like==#
/!=#
makes it more obvious;send(SendParameters{value: amount, to: self.owner, mode: mode})
we can have something likesend {value: amount, to: self.owner, mode: mode}
;send
can actually deploy a contract, it should be evident in the call, something likedeploy {...}
(e.g.send
wouldn't be able to deploy, onlydeploy
could);sender()
in contract initializers (init
) should be calleddeployer()
;/**/
comments in favor of semantic single-line comments, see: Tact 2.0 RFC #249 (comment)Semantical changes
null
to mean "empty map" (actually we might want to rethink our design of optionals and removenull
completely);==
/!=
only accept expressions of the same type: no more implicit type conversions allowing comparingInt
andInt?
;emptyMap
by default, in other wordsm: map<Int, Int>;
without the corresponding entry ininit
should produce a compilation error;==
and!=
: it should be evident that these are not trivial operations in terms of gas consumption;Int
;SendPayGasSeparately
naming, seeSendPayGasSeparately
is a wrong naming #149;send
should support sendingStateInit
directly without destructuring it into thecode
anddata
parts (this can, for instance, simplify theforward
method from theBase
trait);Time
type and possiblyTimeInterval
type too, plus some primitives for working with absolute time and time intervals;now()
builtin should return values of the typeTime
;FunC, Asm, support and interop
asm
blocks support (see here)Standard library, base trait, built-in functions
BaseTrait
's traitsforward
,notify
andreply
are not very descriptive and should be renamed;BaseTrait
should be renamed and explicitly used;Tooling
The text was updated successfully, but these errors were encountered: