Flow Control: a programmer's text editor via @vulcan https://lobste.rs/s/tranme #editors #zig
https://github.com/neurocyte/flow
I’ve really been enjoying writing #zig lately - not as safe as Rust, but with good ergonomics to keep you from messing up too bad I think. Passing around an allocator is a cool idea and makes you think about when to allocate and makes you try to avoid it.
Also, the creator Andrew seems like a pretty smart guy and has made some great decisions on the language!
After almost a week of refactoring and experimenting with several different approaches, I've updated my Zig nD SIMD vector library to be compatible with the latest Zig 0.15.1, and at the same time cleaned up some internals.
The solution I settled on is a mix of techniques proposed by others, and was needed due to the removal of the struct/namespace-merging syntax in the new Zig version, which this library heavily relies on. I don't like that the new source code is now more than 2x larger and involves a huge amount of duplication to address the many special cases of supported operations for different vector sizes and types. I might still take another pass to eliminate those (by using `@compileError()` for unsupported cases), but that'd be an implementation detail downstream users don't have to care about. I tried AOT code generation as well, but the special case handling made this feel less maintainable...
UPDATE: The only breaking change is the handling of vector swizzles. I had to remove the hundreds of named swizzle functions and replaced them with a single (comptime optimized) `.swizzle(vec, pattern)`, e.g. `.swizzle(vec, "xxyy")`...
If you're interested, the new code is here:
https://github.com/thi-ng/zig-thing/blob/main/src/vectors.zig
The readme contains details about the many supported operations:
https://github.com/thi-ng/zig-thing/blob/main/doc/vectors.md
Installation instructions in the main repo readme:
https://github.com/thi-ng/zig-thing/tree/main
A few days ago I started learning a language called #BQN https://mlochbaum.github.io/BQN/ I ported some number crunching code I had from #zig into it and it's roughly 10× smaller! I'm thinking about embedding it into some of my code to handle the mathematically heavy parts.
@floooh is there a way to use sokol-gfx from multiple threads with completely isolated states? No need to synchronize or anything I just want each thread to have it is own state.
Im building a painting app for android. I have canvas (painting) functionality and rasterizer (reading from document and renders the whole document at once) functionality. But I export one dynamic library. Therefore I assume gfx globals shares data between threads? Is there a way to make it thread local?
This is not helping me in the market but what I love doing the most is computer language engineering. I'm learning how to write an #LSP right now to support my born language in neovim. I also discovered #LLVM recently. It lets you compile to any target from a generic ASM. It made me realize something. The first languages where all compiled. Then, we got the interpreted languages. But recently, the new languages are all compiled again! Think of #rust, #go, #zig, #elixir. I wonder if it's because we perfected the tooling in a way that maintaining a compiled language is not that hard anymore. Go is a weird one. It has a garbage collector. Yeah! A compiled language with a garbage collector. It means that there is a process that is embedded in the executable to just do garbage collection. We might now have a real reason anymore to interpret.
Zig’s built-in expectEqualSlices() test assertion produces excellent debug output for byte sequences.
I've just migrated hypergrahz to zig v0.1.5.1 !
It was pretty straightforward except that I forgot to flush correctly in the bench file. The weird characters displayed were a good reminder... Don't forget to flush!
Hitting Peak File IO Performance with Zig via @RunxiYu https://lobste.rs/s/vnkmbc #linux #performance #zig
https://steelcake.com/blog/nvme-zig/
Hitting Peak File IO Performance with Zig
For one of my C projects, I try to use the #zig compiler as a drop-in replacement for gcc.
Basically works, but:
With the flag "-fsanitize=address" enabled, zig cannot find libasan (even though it is installed and is found by gcc).
Did anybody experience this before and knows a fix?
Zig's recent (and sudden) removal of `usingnamespace` completely and utterly destroyed my nD vector types library[1] architecture and I have no idea how to solve this...
Now I must find a way to rewrite and expose hundreds of swizzle functions (many of them conditional & dependent on different vector sizes) as well as other size-specific and value type-specific functionality, all whilst trying to keep the existing API intact and not to pollute or complicate it with additional sub-namespaces, forced by the removal of this syntax...
The only way I can see (so far) involves a huge amount of code duplication and/or avoidance of `comptime` type generation. Even though I can follow some of the reasons & explanations given in the release notes[2], they're feeling extremely handpicked and seemingly are not considering so many other use cases for which this struct-merging feature was super, super helpful...
`usingnamespace` was such a great tool to split up defintions/modules of complex types over several functions/files and then merge them via a single `comptime` wrapper into a single exposed type... rest in peace!
[1] https://github.com/thi-ng/zig-thing/blob/main/src/vectors.zig
[2]https://ziglang.org/download/0.15.1/release-notes.html#usingnamespace-Removed