6 ms·
It can seem like that on the surface, but a closer look reveals a lot of very interesting new features. Here's a few off the top of my head: * Comptime, which
by verdagon 4y ago
It can seem like that on the surface, but a closer look reveals a lot of very interesting new features. Here's a few off the top of my head:
* Comptime, which can serve the purpose of generics without a new sub-language [1]
* Colorblind async-await, basically parameterizing async-ness to avoid the downsides of async's infectious nature [2]
* Hot-code swapping proof-of-concept [3] (Edit: specifically, new to low-level languages, AFAICT)
Pretty cool stuff!
[1] https://kristoff.it/blog/what-is-zig-comptime/ https://kristoff.it/blog/what-is-zig-comptime/
[2] https://kristoff.it/blog/zig-colorblind-async-await/ https://kristoff.it/blog/zig-colorblind-async-await/
[3] https://www.reddit.com/r/Zig/comments/s9toy1/we_have_a_working_hot_code_swapping/ https://www.reddit.com/r/Zig/comments/s9toy1/we_have_a_worki...
- muth02446 4y agoRE 3: Hot-code swapping seems to require a lot of tricky code. Are there compelling use cases that justify the implementation effort? The examples seem to be mostly focused on swapping out functions but I dot see how it could handle structural changes to data structures.
- Cloudef 4y agoHot-code swapping would guarantee a really fast compile times and maybe even "hot reload" of program while it's running. Do not underestimate how much this helps with developer productivity. I'm so tired of the compile times with large C++ codebases...
- cturtle 4y agoExactly! The idea is during development you use the super fast backend that supports hot code swapping. Then when you want to make a release build you use llvm and get all the optimization benefits of a longer compilation.
- ghoward 4y agoZig's async/await isn't actually colorblind. [1] It just seems that way at first. [1]: https://gavinhoward.com/2022/04/i-believe-zig-has-function-colors/ https://gavinhoward.com/2022/04/i-believe-zig-has-function-c...
- anonymoushn 4y agoHello, have you had a chance to check out the successful implementation of the program you attempted to write in that blog post? https://gist.github.com/sharpobject/49bd88416e68606d7812d609831cc8ae https://gist.github.com/sharpobject/49bd88416e68606d7812d609...
- ghoward 4y agoYes, why does that matter? It still shows that Zig's async/await is not colorblind.
- anonymoushn 4y agoIt seemed like most of your post was about not being able to use the two functions through pointers of the same type, but you can use the two functions through pointers of the same type, so maybe now you can delete a majority of your post and submit a retraction to Hacker News or something. I'm not sure you are using the same notion of "colorblind" as most people. All that is claimed is that much application code can be *compile time generic* over the async-ness of the I/O functions it calls. Stepping up the requirements to being runtime generic introduces some difficult concerns about the different error sets of different I/O functions, but async vs. non-async can be handled as in the above gist or by writing like one switch statement.
- ghoward 4y agoMy post has three quotes where people claim Zig is completely colorblind, not just at compile-time. My point stands, especially because of the hoops that gist had to jump through to get it to work.
- 4y ago
- qaq 4y agoErlang has had Hot-code swapping for decades
- brabel 4y agoDart is one of the only compiled languages that also does that (see Flutter).
- freilanzer 4y agoCommon Lisp as well.
- pjmlp 4y agoIf we ignore Java, .NET, Common Lisp and C++.
- brabel 4y agoThose are not compiled to native code (C++ has hot swapping?), which is the obvious meaning of hot-swapping we're discussing here.
- pjmlp 4y agoThey surely are,you apparently aren't aware of the available toolchains for such purpose. Plenty of coments of mine where I list what exists since their early days. Yes, C++ compilers like Visual C++ support it. Or Unreal tooling like Live++.
- brabel 4y agoBut you claim Java can hot swap... I happen to know all about hot-swapping in Java, and it's only good for very simple debugging reloads... not at all at the same level as Dart VM. No one who knows Java would claim that. Common Lisp is only hot-swappable when you're not running a binary, at least from what I know of SBCL. So, it's hard to take your comment seriously. I am unfamiliar with Visual C++'s hot-swapping capabilities, but to claim the language itself can do it seems pretty ridiculous to me, as all you've got is machine code at runtime, C++ has no hot-swapping runtime and could never have one... which makes me think you're just confused about what we're talking about... I am not talking about debuggers here.
- pjmlp 4y agoLisp has had it for decades, full blown graphical workstations were written in it. Oberon used hot code reload for OS modules. Visual C++ has had edit-and-continue for years, and hot reload as improvement since the last two years.