"Dot" in zig is a placeholder for types that can be unambigously inferred from the surrounding expression.
So ".unknown" is a standin for "SomeEnum.unknown" or "SomeStruct.unknown", depending on what .format is.
HN user
"Dot" in zig is a placeholder for types that can be unambigously inferred from the surrounding expression.
So ".unknown" is a standin for "SomeEnum.unknown" or "SomeStruct.unknown", depending on what .format is.
The Zig maintainers clearly think that keeping up with the undocumented native API is less headache than using the documented but notoriously inelegant win32 API.
This might very well be a good idea. Microsoft is not going to change a vital piece of their OS just on a whim. I would wager that even if they wanted to, they would not be able to do so that easily. A large organization maintaining a large software with a billion users just does not move that fast.
Overcommit only matters if you use the system allocator.
To me, the whole point of Zig's explicit allocator dependency injection design is to make it easy to not use the system allocator, but something more effective.
For example imagine a web server where each request handler gets 1MB, and all allocations a request handler does are just simple "bump allocations" in that 1MB space.
This design has multiple benefits: - Allocations don't have to synchronize with the global allocator. - Avoids heap fragmentation. - No need to deallocate anything, we can just reuse that space for the next request. - No need to care about ownership -- every object created in the request handler lives only until the handler returns. - Makes it easy to define an upper bound on memory use and very easy to detect and return an error when it is reached.
In a system like this, you will definitely see allocations fail.
And if overcommit bothers someone, they can allocate all the space they need at startup and call mlock() on it to keep it in memory.
Do the arguments have to be strong? I do not think they need to provide any justification. If the core developers decided that they would be more happy (or less miserable) with a different service, then let them.
I miss the mention of boost::asio in this thread. At first glance this new Io interface feels not that dissimilar to it:
Both are generic interfaces over an event loop/executor supporting async or blocking operations. Both ship a thread-pool and a stackful coroutine backend and both can be used through their respective language's stackless coroutine implementation (co_yield in cpp and yet-unimplemented in zig).
Having a limited number of known callees is already better than a virtual function (unrestricted function pointer). A compiler in theory could devirtualize every two-possible-callee callsite into `if (function_pointer == callee1) callee1() else callee2()` which then can be inlined at compile time or branch-predicted at runtime.
In any case, if you have two different implementations of something then you have to switch between them somewhere -- either at compile-time or link-time or load-time or run-time (or jit-time). The trick is to find an acceptable compromise of performance, (machine)code-bloat and API-simplicity.
I think you just initialize Reader and Writer with a zero-length buffer.
Just to start some discussion about the actual API and not the breaking change aspect of it:
I find the `Reader.stream(writer, limit)` and `Reader.streamRemaining(writer)` functions to be especially elegant to build a push-based data transformation pipeline (like GREP or compression/encryption). You just implement a Writer interface for your state machine and dump the output into another Writer and you don't have to care about how the bytes come and how they leave (be it a socket or shared memory or file) -- you just set the buffer sizes (which you can even set to zero as I gather!)
`Writer.sendFile()` is also nice, I don't know of any other stream abstraction that provides this primitive in the "generic interface", you usually have to downcast the stream to a "FileStream" and work on the file descriptor directly.
Nothing fancy, I found that one can do almost anything with std::vector, a good enough hash map and a simple hand-rolled intrusive list.
The C++ code I write these days is actually pretty similar to Rust: everything is explicit, lots of strong types, very simple and clear lifetimes (arenas, pools), non-owning handles instead of pointers. The only difference in practice is that the build systems are different and that the Rust compiler is more helpful (both in catching bugs and reporting errors). Neither a huge deal if you have a proper build and testing setup and when everybody on your team is pretty experienced.
By the way, using "atoi" in a code snippet in 2025 and complaining that it is "not ideal" is, well, not ideal.
For me, someone from outside the Anglosphere, the British Empire is a distant and unfamiliar concept. I am always bothered by characters in historical fiction speaking with a British accent just to make an impression of ancientness. The antiquity was not ancient back then -- it was modern for its contemporaries.
Rome was as much the dominant economic, cultural and military power of the ancient world as the US is of the present. I would actually prefer American accents being used in movies set in the Roman Empire.
One downside of this approach is that the tested code itself has to be modified to accomodate the testing code.
I think the same could be achieved by launching two threads and single stepping them with ptrace to "randomly" interleave the execution of their instructions. Something like rr's chaos mode.
Some instructions may not be atomic though, so we would need a way to single step on "atomic microcodes" if that's even possible without emulation?
I would absolutely not recommend auto-formatting a legacy codebase. In my experience large C++ projects tend to have not only code generation scripts (python/perl/whatever) but also scripts that parse the code (usually to gather data for code generation). Auto formatting might break that. I have even seen some really cursed projects where the _users_ parsed public header files with rather fragile scripts.
The Internet Speculative Fiction Database is a great resource for publication details of fiction stories. Here is the entry for The Star: https://www.isfdb.org/cgi-bin/title.cgi?40913
I was about to comment that the correct plural form of nova is novae, but it looks like dictionaries say that both novae and novas are correct. The irregular case does seem to predominate according to google ngram viewer.
Despite absolutely loving chess as a child, I never studied it professionally, and I did not even play a single game after primary school. A couple of years ago I stumbled upon a chess video recommendation here on Hacker News. It was the 27th entry of ChessNetwork's Beginner to Chess Master series and it rekindled my love for the game. I have been playing chess casually ever since. I cannot recommend ChessNetwork's videos enough: I found them to be insightful, well-made, and very respectful of both the game and the audience.
In Calibre (the ebook management software) there are two fields: "author name" and "author sort name", both free-form text. The latter serves as the sort key when the books are ordered by author. I have found this solution both elegant and practical.
The sizeof(variant) example is wrong. An extra byte is needed to store the discriminator value, which in practice results in 8 extra bytes for these particular types because of alignment. https://godbolt.org/z/vno3v9rPK
The tuple drawing is also somewhat misleading, because the first box (int) should be the same size as the second one (double), due to alignment.
In Bash (not every shell supports this) functions can be exported, which enables this nice pattern with xargs:
myfunc() {
printf " %s" "I got these arguments:" "$@" $'\n'
}
export -f myfunc
seq 6 | xargs -n2 bash -c 'myfunc "$@"' "$0"This wikipedia article is not very accurate. In Hungary "informatika" is usually used only for primary/secondary school subjects covering every-day IT tasks like document editing, typing, or sending email. The most commonly used names for CS courses are "számításelmélet" or "számítástudomány" which translate as "theory of computing" and "science of computing".
Your comment reminded me of a clever and well-written short story called "Understand" by Ted Chiang.
We could fuzz it and see if we can crash a brain.
Sadly, this we already know. Torture, fear, depression, regret; we have a wide selection to choose from if we want to "crash a brain".