Оооо блин, оказывается книгу по Zig уже делают дней 20 минимум. А Эндрю ток щас ретутнул в мастодоне :)
👍6❤1
Язык Zig (канал)
Оооо блин, оказывается книгу по Zig уже делают дней 20 минимум. А Эндрю ток щас ретутнул в мастодоне :)
https://pedropark99.github.io/zig-book/
https://github.com/pedropark99/zig-book
https://fosstodon.org/@pedropark99/112813567441618116
Бесплатная и открытая, под CC-BY 4.0 лицензией (кратко говоря, просто авторство сохранять и упомянуть https://creativecommons.org/licenses/by/4.0/deed.ru)
https://github.com/pedropark99/zig-book
2/5
There is still a lot to be done. But the idea behind it is to be an Open Book that introduces the language by solving small projects, in a similar style to the famous "Python Chrash Course" book from Eric Matthes.
Ещё многое предстоит сделать. Но идея заключается в том, что это будет открытой книгой, которая знакомит с языком, решая небольшие проекты, в стиле знаменитой книги "Изучаем Python" от Эрика Мэтиз.
https://fosstodon.org/@pedropark99/112813567441618116
Бесплатная и открытая, под CC-BY 4.0 лицензией (кратко говоря, просто авторство сохранять и упомянуть https://creativecommons.org/licenses/by/4.0/deed.ru)
pedropark99.github.io
Introduction to Zig
👍7❤1
Язык-подмножество Zig, интерпретируемый и с сборщиком мусора...
Тут сверху был Zig++, теперь у нас и Zig-- есть :)
https://github.com/sylvrs/zag
Автор стримит разработку здесь: https://www.twitch.tv/sylvrs
Тут сверху был Zig++, теперь у нас и Zig-- есть :)
https://github.com/sylvrs/zag
Автор стримит разработку здесь: https://www.twitch.tv/sylvrs
GitHub
GitHub - sylvrs/zag: A prototype language built off the grammar and standard library of Zig
A prototype language built off the grammar and standard library of Zig - sylvrs/zag
🔥3👍2
`compiler: implement @branchHint by mlugg`
Довольно быстро сделали, пропозал только недавно приняли, вместо
#upstream
Довольно быстро сделали, пропозал только недавно приняли, вместо
@setCold и предлагаемого @expect и т.д.#upstream
GitHub
compiler: implement `@branchHint` by mlugg · Pull Request #21191 · ziglang/zig
See commit messages for details.
👍4👀1
Язык Zig (канал)
`compiler: implement @branchHint by mlugg` Довольно быстро сделали, пропозал только недавно приняли, вместо @setCold и предлагаемого @expect и т.д. #upstream
test "if branch hints" {
var t: bool = undefined;
t = true;
if (t) {
@branchHint(.likely);
} else {
@branchHint(.cold);
}
}
test "orelse branch hints" {
var x: ?u32 = undefined;
x = 123;
const val = x orelse val: {
@branchHint(.cold);
break :val 456;
};
try expect(val == 123);
}👍2👀1
Фреймворк для создания компиляторов на основе графов.
Написано, что их IR основан на работе RVSDG, а оптимизации на e-graphs + equality saturation.
https://docs.vezel.dev/graf
https://github.com/vezel-dev/graf
#библиотеки
Написано, что их IR основан на работе RVSDG, а оптимизации на e-graphs + equality saturation.
https://docs.vezel.dev/graf
https://github.com/vezel-dev/graf
#библиотеки
👀3🔥2🤯2🐳1
Язык Zig (канал)
`compiler: implement @branchHint by mlugg` Довольно быстро сделали, пропозал только недавно приняли, вместо @setCold и предлагаемого @expect и т.д. #upstream
GitHub
Implement `@branchHint` and new `@export` usage by mlugg · Pull Request #21214 · ziglang/zig
This PR is just #21206 and #21191 rebased and rolled into one, to avoid doing two separate updates to zig1.wasm.
🔥3
Бан на одинаковое имя у поля и объявления:
https://github.com/ziglang/zig/pull/21231
Если кто не знал, правила до этого были примерно такие:
* Если у enum/union есть объявление (константа/функция) и поле (тег) с одинаковым названием, то предпочитается объявление
* У struct (самого типа, а не экземпляра) такой проблемы нет, пушто нельзя поле выбирать из типа.
* Если это вызов функции у экземпляра struct (поле с указателем на функцию или объявление-метод), то предпочитается поле
Чёт тип такого:
https://github.com/ziglang/zig/pull/21231
Если кто не знал, правила до этого были примерно такие:
* Если у enum/union есть объявление (константа/функция) и поле (тег) с одинаковым названием, то предпочитается объявление
* У struct (самого типа, а не экземпляра) такой проблемы нет, пушто нельзя поле выбирать из типа.
* Если это вызов функции у экземпляра struct (поле с указателем на функцию или объявление-метод), то предпочитается поле
Чёт тип такого:
const Enum = enum {
a,
const a = 0;
};
const Struct = {
func: *const fn() void,
fn func(_: Struct) void {}
};
comptime {
_ = Enum.a; // выберется "const a = 0;"
// чтобы получить именно тег, можно вот так:
_ = @as(Enum, .a);
_ = Struct.func; // только метод понятное дело, нельзя поля так получать
var instance: Struct = .{ .func = undefined };
_ = instance.func(); // выберется "func: *const fn() void"
// чтобы получить именно метод, можно вот так:
_ = Struct.func(instance);
}GitHub
AstGen: disallow fields and decls from sharing names by mlugg · Pull Request #21231 · ziglang/zig
This is a mini-proposal which is accepted as a prerequisite for #9938. The standard library and compiler needed a few changes to obey the new rules. Most of these are a net gain for readability, I&...
👌4🔥1👀1
Язык Zig (канал)
с labeled switch было бы ещё легче, но тот PR пока не смержили, так шо вот... тут та же стратегия что и в Rust версии используется емнип, в C/C++ как раз goto-шный switch (на который похож наш будущий labeled switch), чет тип такого: state: switch (yystate)…
И опять в другом PR: https://github.com/ziglang/zig/pull/21257
GitHub
compiler: implement labeled switch/continue by mlugg · Pull Request #21257 · ziglang/zig
Implements #8220.
This is a revival of #19812.
@Luukdegram, you might want to check the Wasm changes -- I rebased your work, but haven't tested it, so the rebase could have gone wrong somew...
This is a revival of #19812.
@Luukdegram, you might want to check the Wasm changes -- I rebased your work, but haven't tested it, so the rebase could have gone wrong somew...
👀1
Плюс ещё один древний пропозал делают:
Decl Literals https://github.com/ziglang/zig/issues/9938
PR https://github.com/ziglang/zig/pull/21264
#upstream
Decl Literals https://github.com/ziglang/zig/issues/9938
PR https://github.com/ziglang/zig/pull/21264
#upstream
GitHub
Proposal: Decl Literals · Issue #9938 · ziglang/zig
Enum literals are a powerful and extremely useful feature of Zig. This proposal changes their definition slightly to make them more useful in a wider variety of cases, and renames them to "Dec...
👍1👀1
Язык Zig (канал)
Плюс ещё один древний пропозал делают: Decl Literals https://github.com/ziglang/zig/issues/9938 PR https://github.com/ziglang/zig/pull/21264 #upstream
Пример с PR:
``
Можно считать это генерализацией enum literals (.blabla), теперь они и на объявления внутри контейнеров распространяются (константы и функции)
const S = struct {
x: u32,
y: u32,
fn init(val: u32) S {
return .{ .x = val + 1, .y = val + 2 };
}
};
test "call decl literal" {
const a: S = .init(100);
try std.testing.expectEqual(101, a.val.x);
try std.testing.expectEqual(102, a.val.y);
}
const std = @import("std");``
zig
const S = struct {
x: u32,
const default: S = .{ .x = 123 };
};
test "decl literal" {
const val: S = .default;
try std.testing.expectEqual(123, val.x);
}
const std = @import("std");
``Можно считать это генерализацией enum literals (.blabla), теперь они и на объявления внутри контейнеров распространяются (константы и функции)
👍2🔥1
I really like this syntax for initialization, and I think it's a consistent extension of the
The reader does not necessarily know that the type of
The reader and tools now know for sure that
var x: T = .{} syntax. With the current pattern,const value = package.SomeType.init(4);
The reader does not necessarily know that the type of
value is package.SomeType. This is usually true by convention, but careful readers and editor tools cannot know for sure. In contrast, with the new syntax:const value: package.SomeType = .init(4);
The reader and tools now know for sure that
value must be of type package.SomeType. This syntax conveys extra information, and is consistent with a preference for x: T = .{} over x = T{}.👍2
Forwarded from Svetlana Rogozhina
ребята, всем привет!
ищу Zig разработчика 🧑💻
вакансия: https://career.habr.com/vacancies/1000147586
пишите в личку, кого заинтересует данная позиция)
ищу Zig разработчика 🧑💻
вакансия: https://career.habr.com/vacancies/1000147586
пишите в личку, кого заинтересует данная позиция)
Habr
Вакансия «Zig/С разработчик », удаленно, работа в компании «Вебмониторэкс» — Хабр Карьера
Вакансия «Zig/С разработчик », удаленно, работа в компании «Вебмониторэкс». Полная занятость. Можно удаленно. Вакансия в архиве.
🔥7🤩1
Forwarded from kristoff
The recordings from Software You Can Love Milan 2024 are out: https://www.youtube.com/watch?v=ug-KuDlMTYw&list=PL5AY2Vv6EsfSgmueLbzGVJpWIw8cIFl8J&index=1
❤2
kristoff
The recordings from Software You Can Love Milan 2024 are out: https://www.youtube.com/watch?v=ug-KuDlMTYw&list=PL5AY2Vv6EsfSgmueLbzGVJpWIw8cIFl8J&index=1
Небольшой обзор применения type safety внутри самого компилятора от mlugg: https://m.youtube.com/watch?v=KOZcJwGdQok&list=PL5AY2Vv6EsfSgmueLbzGVJpWIw8cIFl8J&index=2&pp=iAQB
Вроде бы первое его выступление на этой конференции, так шо держим кулачки за него))
Вроде бы первое его выступление на этой конференции, так шо держим кулачки за него))
YouTube
Data-Oriented Design Revisited: Type Safety in the Zig Compiler - Matthew Lugg
From https://softwareyoucan.love Milan 2024
0:00 Intro
0:54 Talk
33:51 Q&A
0:00 Intro
0:54 Talk
33:51 Q&A
👍6
https://github.com/adia-dev/chroma-logger-zig
Разноцветный логгер для Zig проектов.
#библиотеки
Разноцветный логгер для Zig проектов.
std.debug.print(chroma.format("{blue}Eventually, the {red}formatting{reset} looks like {130;43;122}{s} !\n"), .{"this"});#библиотеки
GitHub
GitHub - adia-dev/chroma-logger-zig
Contribute to adia-dev/chroma-logger-zig development by creating an account on GitHub.
👍4😁2
Язык Zig (канал)
https://github.com/adia-dev/chroma-logger-zig Разноцветный логгер для Zig проектов. std.debug.print(chroma.format("{blue}Eventually, the {red}formatting{reset} looks like {130;43;122}{s} !\n"), .{"this"}); #библиотеки
Ещё один, на этот раз структурный:
https://github.com/arats-io/zuffy/blob/2fe32b3b98e95a93e56606d6c2ed37a01c64d19b/src/zlog.md
#библиотеки
https://github.com/arats-io/zuffy/blob/2fe32b3b98e95a93e56606d6c2ed37a01c64d19b/src/zlog.md
#библиотеки
GitHub
zuffy/src/zlog.md at 2fe32b3b98e95a93e56606d6c2ed37a01c64d19b · arats-io/zuffy
Contribute to arats-io/zuffy development by creating an account on GitHub.
👍1