1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00
ton/crypto
tolk-vm 799e2d1265
[Tolk] Rewrite the type system from Hindley-Milner to static typing
FunC's (and Tolk's before this PR) type system is based on Hindley-Milner.
This is a common approach for functional languages, where
types are inferred from usage through unification.
As a result, type declarations are not necessary:
() f(a,b) { return a+b; } // a and b now int, since `+` (int, int)

While this approach works for now, problems arise with the introduction
of new types like bool, where `!x` must handle both int and bool.
It will also become incompatible with int32 and other strict integers.
This will clash with structure methods, struggle with proper generics,
and become entirely impractical for union types.

This PR completely rewrites the type system targeting the future.
1) type of any expression is inferred and never changed
2) this is available because dependent expressions already inferred
3) forall completely removed, generic functions introduced
   (they work like template functions actually, instantiated while inferring)
4) instantiation `<...>` syntax, example: `t.tupleAt<int>(0)`
5) `as` keyword, for example `t.tupleAt(0) as int`
6) methods binding is done along with type inferring, not before
   ("before", as worked previously, was always a wrong approach)
2025-01-15 15:38:43 +03:00
..
block tonNode.getOutMsgQueueProof query in public shard overlays (#1413) 2024-12-04 14:38:57 +03:00
common Export all keys command in validator-engine-console (#1412) 2024-12-03 17:19:12 +03:00
ellcurve TVM instructions: SECP256K1_XONLY_PUBKEY_TWEAK_ADD, SETCONTCTRMANY(X) (#1404) 2024-11-26 16:23:17 +03:00
fift TVM instructions: SECP256K1_XONLY_PUBKEY_TWEAK_ADD, SETCONTCTRMANY(X) (#1404) 2024-11-26 16:23:17 +03:00
func [FunC] Make Expr::VarApply always impure (#1381) 2024-11-14 18:32:04 +03:00
funcfiftlib [Tolk] Rewrite lexer, spaces are not mandatory anymore 2024-11-02 01:33:08 +04:00
keccak TVM Upgrade (#686) 2023-05-24 21:14:13 +03:00
openssl celldb in-memory mode, stats for actors, perf counters, minor fix in rldp2 (#1164) 2024-09-23 17:34:37 +03:00
parser Various changes in TVM, github builds and tests (#793) 2023-11-03 14:43:34 +03:00
smartcont [Tolk] Rewrite the type system from Hindley-Milner to static typing 2025-01-15 15:38:43 +03:00
smc-envelope Extra currencies (#1122) 2024-10-01 10:22:49 +03:00
test TVM instructions: SECP256K1_XONLY_PUBKEY_TWEAK_ADD, SETCONTCTRMANY(X) (#1404) 2024-11-26 16:23:17 +03:00
tl celldb in-memory mode, stats for actors, perf counters, minor fix in rldp2 (#1164) 2024-09-23 17:34:37 +03:00
util Merge branch 'SpyCheese-mintless-util' into testnet 2024-09-13 20:44:47 +03:00
vm Improve async cell loading in DynamicBagOfCellsDb.cpp (#1414) 2024-12-06 11:56:24 +03:00
CMakeLists.txt TVM instructions: SECP256K1_XONLY_PUBKEY_TWEAK_ADD, SETCONTCTRMANY(X) (#1404) 2024-11-26 16:23:17 +03:00
Ed25519.cpp bugfixes + decreased archive slice size 2020-04-08 23:49:28 +04:00
Ed25519.h emergency update 2020-03-24 03:32:16 +04:00