<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Comptime on Mi&amp;Bee Blog</title><link>/en/tags/comptime/</link><description>Recent content in Comptime on Mi&amp;Bee Blog</description><generator>Hugo -- gohugo.io</generator><language>en</language><managingEditor>蓝宝石的傻话</managingEditor><lastBuildDate>Thu, 25 Jun 2026 11:00:00 +0800</lastBuildDate><atom:link href="/en/tags/comptime/rss.xml" rel="self" type="application/rss+xml"/><item><title>Structs and comptime: The Power of Compile-Time Computation</title><link>/en/posts/programming/zig-comptime-structs/</link><pubDate>Thu, 25 Jun 2026 11:00:00 +0800</pubDate><guid>/en/posts/programming/zig-comptime-structs/</guid><description>&lt;p&gt;This article is based on Zig 0.16.&lt;/p&gt;
&lt;p&gt;In the previous post, we covered Zig&amp;rsquo;s error handling and memory management — lightweight &lt;code&gt;try&lt;/code&gt;/&lt;code&gt;catch&lt;/code&gt; fault tolerance, and the explicit allocator-passing philosophy. Now we enter Zig&amp;rsquo;s most essential territory: &lt;strong&gt;structs and methods&lt;/strong&gt;, and the soul of Zig — &lt;strong&gt;compile-time computation (comptime)&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;If you come from Go, you&amp;rsquo;ll appreciate how Zig keeps things simple by defining methods directly inside the struct. If you come from Rust, you&amp;rsquo;ll see a different take on the &lt;code&gt;impl&lt;/code&gt; block pattern. And comptime opens a path to &amp;ldquo;types as values&amp;rdquo; metaprogramming beyond Go generics and Rust traits.&lt;/p&gt;</description></item></channel></rss>