Дожили???
https://github.com/ZigC-Lang/zigc
ZigC is a C-like language with a lot of modern concepts introduced in Zig language, and getting rid of a lot of seemingly unnecessary features from C/C++ and embarrassing peculiarities from Zig syntax.
In result, ZigC is easier than C++/Rust, faster than Go/Java, safer than C/C++, familiar than Rust/Zig, smaller than Rust/C++, and more machine friendly than C/C++/Rust/Go.
...блабла...
...блабла...
ZigC corrected Zig syntax as follows:
* Back to C like syntax from Pascal-like variable, function declaration.
* JSON like struct iniatialization.
* Array bracket [] for array initialization.
* Simple for loops, removing crapy while/for syntax.
* Semicolon in struct/union, instead of comma.
* Back to switch/case/default.
* Non-null, non-error 'quotation, instead of |capture|.
* Error sets merge A|B, not A||B.
* Array concat + and mult *, not ++ and **.
* anyframe(return_type) not anyframe->return_type.
* Public and static.
* Non-public main.
* ! operator, not try ...
* catch (null), instead of 'orelse'.
В репозитории только примеры кода кстати.
https://github.com/ZigC-Lang/zigc
ZigC is a C-like language with a lot of modern concepts introduced in Zig language, and getting rid of a lot of seemingly unnecessary features from C/C++ and embarrassing peculiarities from Zig syntax.
In result, ZigC is easier than C++/Rust, faster than Go/Java, safer than C/C++, familiar than Rust/Zig, smaller than Rust/C++, and more machine friendly than C/C++/Rust/Go.
...блабла...
...блабла...
ZigC corrected Zig syntax as follows:
* Back to C like syntax from Pascal-like variable, function declaration.
* JSON like struct iniatialization.
* Array bracket [] for array initialization.
* Simple for loops, removing crapy while/for syntax.
* Semicolon in struct/union, instead of comma.
* Back to switch/case/default.
* Non-null, non-error 'quotation, instead of |capture|.
* Error sets merge A|B, not A||B.
* Array concat + and mult *, not ++ and **.
* anyframe(return_type) not anyframe->return_type.
* Public and static.
* Non-public main.
* ! operator, not try ...
* catch (null), instead of 'orelse'.
В репозитории только примеры кода кстати.
GitHub
GitHub - ZigC-Lang/zigc: ZigC Language Description
ZigC Language Description. Contribute to ZigC-Lang/zigc development by creating an account on GitHub.
🤨3
Язык Zig (канал)
Дожили??? https://github.com/ZigC-Lang/zigc ZigC is a C-like language with a lot of modern concepts introduced in Zig language, and getting rid of a lot of seemingly unnecessary features from C/C++ and embarrassing peculiarities from Zig syntax. In result…
https://github.com/ZigC-Lang/zigc/blob/102b162a30626d0d7c1885da1acdd44d9e7c125f/15.%20ZigC%20Syntax%20Principle.md
Followings are how ZigC syntax is formulated:
* shoul be most comfortable for C programmers.
should accommodate all modern syntax introduced by Zig, but in more C-like way.
* should take simplist form, comparing among other modern languages.
* should guarrantee zero overhead on Zig, which also guarrantees zero overhead on C.
* may take away unnecessary details from Zig, if possible.
* may compromise rigid rules, if it helps programmer's happyness.
* may slightly sacrifice compile time, if it helps programmer's sanity.
Followings are how ZigC syntax is formulated:
* shoul be most comfortable for C programmers.
should accommodate all modern syntax introduced by Zig, but in more C-like way.
* should take simplist form, comparing among other modern languages.
* should guarrantee zero overhead on Zig, which also guarrantees zero overhead on C.
* may take away unnecessary details from Zig, if possible.
* may compromise rigid rules, if it helps programmer's happyness.
* may slightly sacrifice compile time, if it helps programmer's sanity.
GitHub
zigc/15. ZigC Syntax Principle.md at 102b162a30626d0d7c1885da1acdd44d9e7c125f · ZigC-Lang/zigc
ZigC Language Description. Contribute to ZigC-Lang/zigc development by creating an account on GitHub.
Язык Zig (канал)
https://github.com/ZigC-Lang/zigc/blob/102b162a30626d0d7c1885da1acdd44d9e7c125f/15.%20ZigC%20Syntax%20Principle.md Followings are how ZigC syntax is formulated: * shoul be most comfortable for C programmers. should accommodate all modern syntax introduced…
Я так понял это чудо строится ПОВЕРХ Zig, вот он, наш ответ C++... Zig+-
🤣2
Debugging a Zig Test Failure
https://zinascii.com/2023/debugging-a-zig-test-failure.html
Про исправление ошибки в стандартной библиотеки Zig для платформы Illumos (если точнее, дистрибутив OmniOS). Много разьяснений и мыслей (ну или воды, для кого как) про отладку, DTrace и т.д.
#блоги
https://zinascii.com/2023/debugging-a-zig-test-failure.html
Про исправление ошибки в стандартной библиотеки Zig для платформы Illumos (если точнее, дистрибутив OmniOS). Много разьяснений и мыслей (ну или воды, для кого как) про отладку, DTrace и т.д.
#блоги
Zinascii
Debugging a Zig Test Failure
Debugging a Zig test failure using DTrace speculative tracing.
https://github.com/ziglang/zig/pull/17497
pub fn fatal(comptime fmt: []const u8, args: anytype) error{TestFatal} {
fail(fmt, args);
return error.TestFatal;
}
оказывается можно писать и так, думал только error{TestFatal}!void (и т.д.) работает
pub fn fatal(comptime fmt: []const u8, args: anytype) error{TestFatal} {
fail(fmt, args);
return error.TestFatal;
}
оказывается можно писать и так, думал только error{TestFatal}!void (и т.д.) работает
GitHub
std.testing: fail and fatal formatted messaging by pascaldekloe · Pull Request #17497 · ziglang/zig
Two new functions in std.testing:
/// Fail the test with a formatted message but continue execution, unlike fatal.
/// The common pattern is as follows.
///
/// ```zig
/// if (got != want)
/// ...
/// Fail the test with a formatted message but continue execution, unlike fatal.
/// The common pattern is as follows.
///
/// ```zig
/// if (got != want)
/// ...
BuiltinFunction: Use a generated DAFSA (deterministic acyclic finite state automaton) instead of a generated enum
https://github.com/Vexu/arocc/pull/524
related: оптимизация std.meta.stringToEnum https://github.com/ziglang/zig/issues/3863#issuecomment-1763271656
#upstream #производительность
https://github.com/Vexu/arocc/pull/524
related: оптимизация std.meta.stringToEnum https://github.com/ziglang/zig/issues/3863#issuecomment-1763271656
#upstream #производительность
GitHub
BuiltinFunction: Use a generated DAFSA instead of a generated enum by squeek502 · Pull Request #524 · Vexu/arocc
A DAFSA (deterministic acyclic finite state automaton) is essentially a trie flattened into an array, but that also uses techniques to minimize redundant nodes. This provides fast lookups while min...
Язык Zig (канал)
BuiltinFunction: Use a generated DAFSA (deterministic acyclic finite state automaton) instead of a generated enum https://github.com/Vexu/arocc/pull/524 related: оптимизация std.meta.stringToEnum https://github.com/ziglang/zig/issues/3863#issuecomment-1763271656…
GitHub
GitHub - Validark/Accelerated-Zig-Parser: A high-throughput parser for the Zig programming language.
A high-throughput parser for the Zig programming language. - Validark/Accelerated-Zig-Parser
usingnamespace оказывается ещё и на enum/union работает... (я думал только на struct и opaque) тот же результат — публичные обьявления ре-экспортируются
Язык Zig (канал)
usingnamespace оказывается ещё и на enum/union работает... (я думал только на struct и opaque) тот же результат — публичные обьявления ре-экспортируются
const Location = enum(u32) {
box = 0,
stolovaya = 1,
workshop = 2,
mine = 3,
_,
pub const start_facilites: u32 = 2;
pub const end_facilities: u32 = 3;
}
const Everything = struct {
pub usingnamespace Location; // теперь можно писать Everything.start_facilities, но не Everything.box пушто не публичное обьявление, а просто член
};
Königskraut
немного оффтопик, но смотрите что теперь в телеграме есть const std = @import("std"); pub fn main() !void { std.debug.print("kek\n", .{}); }
В k версии [1.9.6 (418)] старый вид, в z/a [10.0.15] новый (с кнопкой копировать) но подсветки нет, в десктоп клиенте [4.11.1] есть и кнопка и подсветка
Кстати насчёт той весёлой задачки „Man or boy test” с Rosetta Code, я по фану сегодня таки сделал её (немного схитрил внутри, но шо поделать — Зиг так хочет), вроде работает с правильными результатами вплоть до 20, дальше мне стека не хватило:
https://rosettacode.org/wiki/Man_or_boy_test?oldid=358095#Zig
https://rosettacode.org/wiki/Man_or_boy_test?oldid=358095#Zig
Rosetta Code
Man or boy test
Background: The man or boy test was proposed by computer scientist Donald Knuth as a means of evaluating implementations of the ALGOL 60 programming language. The...
🤔1
Язык Zig (канал)
Кстати насчёт той весёлой задачки „Man or boy test” с Rosetta Code, я по фану сегодня таки сделал её (немного схитрил внутри, но шо поделать — Зиг так хочет), вроде работает с правильными результатами вплоть до 20, дальше мне стека не хватило: https://ro…
const Record = struct {
yieldFn: *const fn (record: *Record) i32,
k: *i32 = undefined,
x1: *Record = undefined,
x2: *Record = undefined,
x3: *Record = undefined,
x4: *Record = undefined,
x5: *Record = undefined,
inline fn run(record: *Record) i32 {
return record.yieldFn(record);
}
pub fn A(record: *Record) i32 {
return if (record.k.* <= 0)
record.x4.run() + record.x5.run()
else
record.B();
}
fn B(record: *Record) i32 {
record.k.* -= 1;
var k_copy_on_stack: i32 = record.k.*;
var b: Record = .{
.yieldFn = &Record.B,
.k = &k_copy_on_stack,
.x1 = record,
.x2 = record.x1,
.x3 = record.x2,
.x4 = record.x3,
.x5 = record.x4,
};
return b.A();
}
};
const numbers = struct {
fn positiveOne(unused_record: *Record) i32 {
_ = unused_record;
return 1;
}
fn zero(unused_record: *Record) i32 {
_ = unused_record;
return 0;
}
fn negativeOne(unused_record: *Record) i32 {
_ = unused_record;
return -1;
}
};
const std = @import("std");
pub fn main() void {
var i: u31 = 0;
while (i <= 31) : (i += 1) {
var k: i32 = i;
var @"+1_record": Record = .{ .yieldFn = &numbers.positiveOne };
var @"0_record": Record = .{ .yieldFn = &numbers.zero };
var @"-1_record": Record = .{ .yieldFn = &numbers.negativeOne };
var record: Record = .{
.yieldFn = &Record.B,
.k = &k,
.x1 = &@"+1_record",
.x2 = &@"-1_record",
.x3 = &@"-1_record",
.x4 = &@"+1_record",
.x5 = &@"0_record",
};
std.debug.print("[{d:>3}] = {d}\n", .{ i, record.A() });
}
}https://ziglang.org/learn/build-system/
Будущая документация про Zig Build System (будет перенесена в доки std.Build как я понял)
#upstream
Будущая документация про Zig Build System (будет перенесена в доки std.Build как я понял)
#upstream
⚡3
Язык Zig (канал)
Чутка набираю пока в https://github.com/ziglang-ru/zighelp https://zighelp.org/ru/ Плюс немного копирую с старой попытки перевести ziglearn.org. Кто хочет присоединяйтесь))
https://zig.guide/
Тот же ziglearn, только с другим интерфейсов (судя по всему тоже от Sobeston, оригинального автора ziglearn)
Тот же ziglearn, только с другим интерфейсов (судя по всему тоже от Sobeston, оригинального автора ziglearn)
zig.guide
Welcome | zig.guide
Get started with the Zig programming language. Zig is a general-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.
👍1
Generating a Star Sphere using Zig
https://pollrobots.com/blog/zig/code/2023/11/11/star-sphere-in-zig.html
Генерация карты звезд с помощью разбора звездного каталога.
#блоги
https://pollrobots.com/blog/zig/code/2023/11/11/star-sphere-in-zig.html
Генерация карты звезд с помощью разбора звездного каталога.
#блоги
👍3