Skip to content

Conversation

xssnick
Copy link
Contributor

@xssnick xssnick commented May 12, 2025

No description provided.

SpyCheese and others added 30 commits April 21, 2025 11:47
* not always gh mac runners have nproc utility

* deprecate Ubuntu 20.04

* fix linking issues of portable tonlibjson.dylib

* fix libemulator.dylib linking issues
Now, only VarDescr::int_const represents whether it's a constant,
without being combined (and potentially become unsync) val bit.
Support declaring structures with arbitrary fields
and creating objects very similar to TS syntax.
Structs are actually tensors on a stack, and accessing their
fields behave exactly as accessing tensor's elements by index.
As a consequence, recurring struct fields doesn't work;
it will lead to infinity size.

All features of type system (nullables, unions) seamlessly
work with structures. A struct with 1 field has no extra
overhead, it's just a field on a stack.
Now fields can have default values, even complex ones:
> tensor: (int, coins) = (2, ton("0.05"))
Initial value must be a constant expression.

Global constants can also now be of any type,
including tensors and nullables.
Constant evaluator was almost dropped off, evaluation
is now done at IR (Ops) level.
Until this MR, parsing any type from tokens immediately
resulted in TypePtr.
This MR introduces an intermediate AST representation for types,
which are resolved at a later step.
It's a necessary refactoring towards generics.
Now structures can be generic: Container<T> and similar.
The same goes for type aliases: type A<T> = Container<T>.

Like generic functions, every struct is instantiated,
"Container<int>" and "Container<slice>" become different
symbols, and on instantiation they walk though the pipeline.
Type inferring and checking are done only upon instantiation.
This update greatly enhances reading Fift output:
1) stack comments are aligned
2) original lines from .tolk files are output as comments,
   grouping asm instructions

Internally, every AsmOp now has SrcLocation.
When outputting them one by one, an original .tolk line is
inserted if locations differ.
This can be optimized later by storing an index
to fast mapping of location (offset) into a line in a file.
In FunC, any function could be called `f(arg)` or `arg.f()`.
You had to call `cell.cell_hash()` / `slice.slice_hash()`:
these were two different global-scope functions.

Now, Tolk, as other languages, separates functions from methods.
It drops the ability to call a function via dot;
you can only call a method (for an object type).

> fun cell.hash(self): int ...
> fun slice.hash(self): int ...

With methods, stdlib functions became short:
`t.size()` instead of `t.tupleSize()`, and so on.

Methods can be declared for any type, including generics.
Calling a method, the compiler does type matching to detect
the only method from many equally named. This could be
generalized to functions overloading some day.
This is now valid:
> struct Container<T = int?> { item: T = null }
> Container{}   // does Container<int?>

Defaults for Ts work both for functions and structs.
Their main purpose is to have the `never` default:
> struct WithOptField<T = never> { f: T; }
I've added a rule that if a struct has the `never` field,
it can be missed out from a literal while creation
(like it doesn't exist at all).
This will be used in stdlib later.
This partially "reverts" the behavior of pragma
'compute-asm-ltr' from FunC, which was always on in Tolk.
Now, if it's safe, for asm functions with arg_order,
arguments are evaluated and placed onto the stack
in a desired order. When it's unsafe (the purpose
of this pragma, actually), arguments are evaluated
left-to-right.
Tolk v0.12: structures, generics, and methods
mkiesel and others added 30 commits September 15, 2025 21:46
ArchiveFile::start_up() truncates packfiles unconditionally,
causing unneeded filesystem writes (mtime) and complicating
auditing on file level.

Co-authored-by: mkiesel <[email protected]>
Previously, `never` could be specified, but was not auto-inferred.
(because it's done the same way in TypeScript)
Now, it's auto-inferred, which is more expected in our case.
…#1800)

* add libgslcblas into portable binaries

* remove commented line

* update target OSX for macos 15

* ensure system headers come from the right macOS SDK.
…#1800)

* add libgslcblas into portable binaries

* remove commented line

* update target OSX for macos 15

* ensure system headers come from the right macOS SDK.
Fix failing Github MacOS actions due to updated XCode (ton-blockchain#1800)
Tolk v1.1: built-in map<K,V>, enums, private and readonly fields, methods overloading
…on-blockchain#1808)

* add libgslcblas into portable binaries

* remove commented line

* fix portable linux binaries

* force llvm jammy installation on ubuntu 22.04
Version 12: new bounce, BTOS, HASHBU opcodes
test-smartcont: decrease number of keys in multisig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.