
Україна Online: Новини | Політика

Телеграмна служба новин - Україна

Резидент

Мир сегодня с "Юрий Подоляка"

Труха⚡️Україна

Николаевский Ванёк

Лачен пише

Реальний Київ | Украина

Реальна Війна

Україна Online: Новини | Політика

Телеграмна служба новин - Україна

Резидент

Мир сегодня с "Юрий Подоляка"

Труха⚡️Україна

Николаевский Ванёк

Лачен пише

Реальний Київ | Украина

Реальна Війна

Україна Online: Новини | Політика

Телеграмна служба новин - Україна

Резидент
TL
TOLK lang
Channel devoted to TOLK — "next-generation FunC" — a language for writing smart contracts in TON
TGlist рейтинг
0
0
ТипАчык
Текшерүү
ТекшерилбегенИшенимдүүлүк
ИшенимсизОрду
ТилиБашка
Канал түзүлгөн датаСерп 05, 2024
TGlistке кошулган дата
Лют 21, 2025Рекорддор
20.04.202523:59
234Катталгандар30.04.202523:59
300Цитация индекси30.01.202523:59
1.7K1 посттун көрүүлөрү15.03.202515:09
6181 жарнама посттун көрүүлөрү12.04.202523:59
5.39%ER28.01.202510:57
1026.05%ERRӨнүгүү
Катталуучулар
Citation индекси
Бир посттун көрүүсү
Жарнамалык посттун көрүүсү
ER
ERR
08.04.202509:12
🫧 Tolk v0.11: type aliases, union types, and pattern matching
This update might confuse you at first. You may wonder: "Why do we need this? How will it be useful?". But in the end, you'll see how everything comes together bringing seamless and generalized message handling.
✅ Notable changes in Tolk v0.11:
1. Type aliases
2. Union types
3. Pattern matching for types
4. Operators
5. Pattern matching for expressions
6. Semicolon for the last statement in a block can be omitted
PR on GitHub with detailed info.
✔ Type aliases
Tolk now supports type aliases, similar to TypeScript and Rust.
An alias creates a new name for an existing type but remains interchangeable with it. No performance overhead — a compile-time feature.
✔ Union types `T1 | T2 | ...`
They now allow a variable to hold multiple possible types.
Nullable types
At the TVM level, union types work as tagged unions — similar to Rust enums but more flexible.
✔ Pattern matching
The only way to work with union types is matching them:
Matching is based on smart casts — inside each branch, the variable is automatically narrowed to the matched type.
It can also be used as an expression:
So, `match` + smart casts are our way for union types. You may notice that it's close to enums in Rust. But we don't have enum. Union types are more general and powerful.
✔ `match` for expressions
As you see, match also works for constant expressions, similar to switch in other languages.
✔ Union types and TL/B `Either`
Look how clean this is:
No need to manually handle bits from the slice — it's naturally expressed in the type system!
✔ Union types and TL/B constructors
Moreover — handling incoming messages is beautifully expressed with union types.
✔ Union types and future structures
The ultimate goal? You'll describe each incoming message as a struct, create a union type for them, parse a slice, and just match over variants:
🌳 So, union types (that perfectly work with tensors) will seamlessly work with structures. With union types, you will declare both Either and different kinds of messages. Combined with intN and other types, they will allow to express (almost) any practical TL/B construction. They are not limited to message routing — in other words, message routing does not differ from handling any field, any storage, or any cell in general.
This update might confuse you at first. You may wonder: "Why do we need this? How will it be useful?". But in the end, you'll see how everything comes together bringing seamless and generalized message handling.
✅ Notable changes in Tolk v0.11:
1. Type aliases
type NewName =
2. Union types
T1 | T2 | ...
3. Pattern matching for types
4. Operators
is
and !is
5. Pattern matching for expressions
6. Semicolon for the last statement in a block can be omitted
PR on GitHub with detailed info.
✔ Type aliases
Tolk now supports type aliases, similar to TypeScript and Rust.
An alias creates a new name for an existing type but remains interchangeable with it. No performance overhead — a compile-time feature.
✔ Union types `T1 | T2 | ...`
They now allow a variable to hold multiple possible types.
Nullable types
T?
are now formally T | null
. At the TVM level, union types work as tagged unions — similar to Rust enums but more flexible.
✔ Pattern matching
The only way to work with union types is matching them:
Matching is based on smart casts — inside each branch, the variable is automatically narrowed to the matched type.
It can also be used as an expression:
So, `match` + smart casts are our way for union types. You may notice that it's close to enums in Rust. But we don't have enum. Union types are more general and powerful.
✔ `match` for expressions
As you see, match also works for constant expressions, similar to switch in other languages.
✔ Union types and TL/B `Either`
T1 | T2
will be directly mapped to TL-B (Either T1 T2)
. Look how clean this is:
(Either SmallPayload LargePayload)
becomes
No need to manually handle bits from the slice — it's naturally expressed in the type system!
✔ Union types and TL/B constructors
T1 | T2 | ...
is a typed way to describe multiple constructors from TL/B. Generally, they can be used anywhere inside a storage or a message. Moreover — handling incoming messages is beautifully expressed with union types.
✔ Union types and future structures
The ultimate goal? You'll describe each incoming message as a struct, create a union type for them, parse a slice, and just match over variants:
🌳 So, union types (that perfectly work with tensors) will seamlessly work with structures. With union types, you will declare both Either and different kinds of messages. Combined with intN and other types, they will allow to express (almost) any practical TL/B construction. They are not limited to message routing — in other words, message routing does not differ from handling any field, any storage, or any cell in general.
20.03.202509:12
🫧 Tolk v0.10: preparing for serialization — intN, bytesN, coins
This update lays the foundation of future auto-packing to/from cells by solving one critical question:
How should fields be serialized?
✅ Notable changes in Tolk v0.10:
1. Fixed-size integer types:
2. Type
3. Types
4. Replace
5. Trailing comma support
PR on GitHub with detailed info.
❓ Fixed-size integers? In TVM? What?
Imagine Tolk already has structures, and we define an incoming message:
A client sends this message following the TL/B schema:
But how do we tell the compiler that counter_id is int32 and inc_by is int64? This information is missing in the struct definition.
✖ Rejected approaches: why they fail
Several syntax ideas were considered:
Each of these quickly breaks down when handling more complex cases.
For example, how would we handle TL-B
And what about TL/B
With every new case, the syntax becomes more complex, ambiguous, and error-prone.
✔ The solution: `int32` as a first-class type
No annotations. No confusing
This scales perfectly:
These are distinct types. A variable can be
This makes serialization predictable, structured, and error-free.
✔ What about overflow?
A reasonable question: what happens if a value exceeds the limit?
Answer: no runtime overflow or clamping! It's just int at TVM.
* arithmetic works normally – v becomes 256
* no extra gas cost – no runtime bounds checks
* overflow will only happen at serialization
✔ Why is this the best approach?
Think of smart contracts as a black box:
- inputs are encoded (int32, uint64, etc.)
- inside the contract, arithmetic uses full 257-bit precision
- outputs are serialized again — overflow happens only at this stage
This is similar to how mulDivFloor(x,y,z) uses 513-bit precision internally. Your contract keeps precision internally and only enforces constraints at the border with an outside world.
🌳 Tolk will follow a type-based philosophy
This post covered the foundation of automatic serialization. The right way is to have a rich type system. Having nested types, having generics, having aliases — will allow to describe every practical TL/B case, but at a language level.
In v0.10, we introduce
How will
Stay tuned for the next update...
This update lays the foundation of future auto-packing to/from cells by solving one critical question:
How should fields be serialized?
✅ Notable changes in Tolk v0.10:
1. Fixed-size integer types:
int32
, uint64
, etc.2. Type
coins
and function ton("0.05")
3. Types
bytesN
and bitsN
(backed by slices at TVM)4. Replace
"..."c
postfixes with stringCrc32("...")
functions5. Trailing comma support
PR on GitHub with detailed info.
❓ Fixed-size integers? In TVM? What?
Imagine Tolk already has structures, and we define an incoming message:
A client sends this message following the TL/B schema:
counterIncrement
counter_id:int32
inc_by:int64
= CounterIncrement;
But how do we tell the compiler that counter_id is int32 and inc_by is int64? This information is missing in the struct definition.
✖ Rejected approaches: why they fail
Several syntax ideas were considered:
Each of these quickly breaks down when handling more complex cases.
For example, how would we handle TL-B
Maybe int32
? Would we write:
And what about TL/B
Both (Maybe int32) int64
?
With every new case, the syntax becomes more complex, ambiguous, and error-prone.
✔ The solution: `int32` as a first-class type
No annotations. No confusing
as
syntax. No ambiguity.This scales perfectly:
These are distinct types. A variable can be
int32
and similar:
This makes serialization predictable, structured, and error-free.
✔ What about overflow?
A reasonable question: what happens if a value exceeds the limit?
Answer: no runtime overflow or clamping! It's just int at TVM.
* arithmetic works normally – v becomes 256
* no extra gas cost – no runtime bounds checks
* overflow will only happen at serialization
✔ Why is this the best approach?
Think of smart contracts as a black box:
- inputs are encoded (int32, uint64, etc.)
- inside the contract, arithmetic uses full 257-bit precision
- outputs are serialized again — overflow happens only at this stage
This is similar to how mulDivFloor(x,y,z) uses 513-bit precision internally. Your contract keeps precision internally and only enforces constraints at the border with an outside world.
🌳 Tolk will follow a type-based philosophy
This post covered the foundation of automatic serialization. The right way is to have a rich type system. Having nested types, having generics, having aliases — will allow to describe every practical TL/B case, but at a language level.
In v0.10, we introduce
intN
(fixed integers), bytesN
(definite slices), coins
(variadic integers), and some more additions. Read the details in the PR.How will
Either L R
and even more complex TL/B structures be expressed? Stay tuned for the next update...
Көбүрөөк функцияларды ачуу үчүн кириңиз.