Язык Zig (канал)
174 subscribers
26 photos
3 videos
6 files
239 links
Download Telegram
Язык Zig (канал)
https://github.com/ziglang/zig/releases/tag/0.10.0 https://ziglang.org/download/0.10.0/release-notes.html #upstream #блоги
Now that the Self-Hosted Compiler is launched, we can move on with the roadmap!
The major themes of the 0.11.0 release cycle will be language changes, compilation speed, and package management.
Some upcoming milestones we will be working towards in the 0.11.0 release cycle:
Finishing the tail end of test coverage - getting the Self-Hosted Compiler to pass a strict superset of tests passed by the Bootstrap Compiler. This is down to a few dozen compile error tests.
Self-Hosted Compiler can build itself with the C Backend. Unlocks ability to replace the Bootstrap Compiler with generated C code (#5246).
Many Accepted Proposals implemented. Expect breakage!
Behavior tests passing for the x86 Backend, aarch64 Backend, or WebAssembly Backend. Unleashes our full compilation speed when targeting the respective architecture.
Experimental first implementation of the official package manager.
Fuzz test incremental compilation so that we can enable it and gain compilation speed for all backends, including the LLVM backend.
Self-Hosted Linker support for ELF and COFF. Eliminate dependency on LLD.
Hot code swapping for Windows, macOS, and Linux.
Introduce Concurrency to semantic analysis to further increase compilation speed.

#upstream
2
A library for writing zero-cost, declarative, understandable, generic code in zig. Has built-in error-reporting to guide programmers into writing correct code, and aims to be a ziggy way of implementing traits/interfaces with no runtime overhead.

https://github.com/mov-rax/zig-validate

Насколько я понял, эта библиотека завязана на разделении function body [fn ()] и function pointer [*const fn ()] в self-hosted компиляторе, поэтому будет работать только с ним (0.10.0)

#библиотеки
👍1
Язык Zig (канал)
Zig Using WASI and the C backend to delete the C++ compiler implementation #upstream
Nuke the C++ implementation of Zig from orbit using WASI #13560

The idea here is to use a small WASI binary as a stage1 kernel that is committed to source control and therefore can be used to build any commit from source. We provide a minimal WASI interpreter implementation that is built from C source, and then used to translate the Zig self-hosted compiler source code into C code. The C code is then compiled & linked, again by the system C compiler, into a stage2 binary. The stage2 binary can then be used repeatedly with zig build to build from source from that point on.

The WASI stage1 blob only needs to be updated when a breaking change or new feature affects the self-hosted compiler when building itself. For example, a bug fix that the self-hosted compiler does not trigger when building itself can be ignored. However, if the bug fix is required for zig to build itself, then the stage1 WASI blob needs to be updated. Similarly when the language is changed and the compiler wants to use the changes to build itself, the blob needs to be updated.

The WASI blob is produced with zig build update-zig1 which uses the LLVM backend to produce a ReleaseSmall binary that targets wasm32-wasi with a CPU of generic+bulk_memory. This produces a 2.6 MiB file. It is then optimized with wasm-opt -Oz --enable-bulk-memory bringing the total down to 2.4 MiB. Finally, it is compressed with zstd, bringing the total down to 655 KB. This is offset by the size of the zstd decoder implementation in C, however it is worth it because the zstd implementation will change rarely if ever, saving a total of 1.8 MiB every time the blob is updated.

I built this branch and master branch from source at the same time and got these results:

compiling from source with ninja install,
configured with
-DCMAKE_BUILD_TYPE=Release -DZIG_NO_LIB=ON:
master branch: 13m20s with 10.3 GiB peak RSS
wasi-bootstrap branch: 10m53s with 3.2 GiB peak RSS


Big thanks to @jacobly0 who has done significant work on the C backend to enable this possibility, as well as helping write the WASI interpreter and make it go fast, over in the external zig-wasi repo. In fact, after rewriting the interpreter a few times he figured out how to make it run even faster by translating the wasm code to C instead of interpreting it directly.
Closes #5246
Closes #6378
Closes #6485

# Prerequisites:

These are already merged inside this branch:
remove -fstage1 option #13383
WebAssembly-only fast allocator #13513
C backend: unblock progress on #13560 #13561
cbe bug fixes and improvements #13715

# Enhancements Needed
Merge blockers:
make zig1.c detect the host -target and pass correct flags to WASI argv
avoid hard-coding --color on in CMake
fix the -target parameter computation in CMake

Nice to have:

look into compressing zig1.wasm with zstd or gzip and having a mini zstd or gzip decoder in zig1.
enhance C backend so it generates fewer bytes of .c code
enhance C backend so it generates .c code that compiles faster
* enhance C backend so compiling the .c code generates no warnings
* C backend: generate MSVC-compatible code  #13574
* C backend: generate GCC-compatible code #13575

#upstream
👍1
Язык Zig (канал)
Nuke the C++ implementation of Zig from orbit using WASI #13560 The idea here is to use a small WASI binary as a stage1 kernel that is committed to source control and therefore can be used to build any commit from source. We provide a minimal WASI interpreter…
> We will be temporarily regressing async/await/suspend/resume in master branch.

Компилятор на C++ удалят ДО того, как добавят поддержку вышеуказанного в self–hosted компилятор

> The plan is to merge this into master branch before completing #6025. Users of async functions should stick to 0.10.0 for now.
🔥1
Channel photo updated
С НООООВЫМ ГОДОМ! 🎄🎊❄️🎄🦎🦎🦎
🎉1032🤯2
In the Zig project, we closed 19% of total open issues during December this year.

This was not the work of a "stale bot", but of humans who painstakingly verified that each and every issue was resolved and had test coverage if applicable.

Finally, our technical debt is being paid off and we can reach for some ambitious goals in 2023.
https://mastodon.social/@andrewrk/109621905821062620
👍2
In about 30 minutes I'll stream working towards the Zig Package Manager.

This will be a yak-shaving stream - there is much to do before we can work on the package manager logic itself.

https://twitch.tv/andrewrok/
https://mastodon.social/@andrewrk/109627337708582296
👍1
For those who haven't followed the discusison in #berlin, March 1st we're going to have a one-off event hosted by Delivery Hero.

We're going to have 3 short talks by Adam (the organizer), Joachim (everyone's favorite german-singaporean, also core team member), and me. The talks are going to be accessible for newcomers so don't be afraid.

Delivery Hero is offering food, drinks and afterwards we're going out to a pub with those who want to spend a bit of extra time together.

https://www.meetup.com/zigberlin-meetup-group/events/290511497
👍1
Язык Zig (канал)
https://kristoff.it/blog/zig-self-hosted-now-what/ #upstream #блоги
А вот и "new for loop syntax" из поста :)
https://github.com/ziglang/zig/pull/14671
zig fmt пофиксит старый код 😋
#upstream

P.S. тут ответ на более ранний пост в канале, но в чате походу не видно

upd: Смержили 🎉🎉🎉
🎉4🤔1