サクサク読めて、アプリ限定の機能も多数!
トップへ戻る
GWの過ごし方
antonz.org
Creating a subset of Go that translates to C was never my end goal. I liked writing C code with Go, but without the standard library it felt pretty limited. So, the next logical step was to port Go's stdlib to C. Of course, this isn't something I could do all at once. I started with the io package, which provides core abstractions like Reader and Writer, as well as general-purpose functions like C
Modern system programming languages, from Hare to Zig, seem to agree that defer is a must-have feature. It's hard to argue with that, because defer makes it much easier to free memory and other resources correctly, which is crucial in languages without garbage collection. The situation in C is different. There was a N2895 proposal by Jens Gustedt and Robert Seacord in 2021, but it was not accepted
Everyone likes interfaces in Go and traits in Rust. Polymorphism without class-based hierarchies or inheritance seems to be the sweet spot. What if we try to implement this in C? Interfaces in Go • Traits in Rust • Toy example • Interface definition • Interface data • Method table • Method table in implementor • Type assertions • Separate self • Final thoughts Interfaces in GoAn interface in Go is
Go 1.26 is coming out in February, so it's a good time to explore what's new. The official release notes are pretty dry, so I prepared an interactive version with lots of examples showing what has changed and what the new behavior is. Read on and see! new(expr) • Recursive type constraints • Type-safe error checking • Green Tea GC • Faster cgo and syscalls • Faster memory allocation • Vectorized o
Part of the Accepted! series: Go proposals and features explained in simple terms. The modernized go fix command uses a fresh set of analyzers and the same infrastructure as go vet. Ver. 1.26 • Tools • Medium impact SummaryThe go fix is re-implemented using the Go analysis framework — the same one go vet uses. While go fix and go vet now use the same infrastructure, they have different purposes an
Part of the Accepted! series: Go proposals and features explained in simple terms. Introducing errors.AsType — a modern, type-safe alternative to errors.As. Ver. 1.26 • Stdlib • High impact SummaryThe new errors.AsType function is a generic version of errors.As: // go 1.13+ func As(err error, target any) bool // go 1.26+ func AsType[E error](err error) (E, bool)
Here's some popular programming advice these days: Learn to decompose problems into smaller chunks, be specific about what you want, pick the right AI model for the task, and iterate on your prompts. Don't do this. I mean, "learn to decompose the problem" — sure. "Iterate on your prompts" — not so much. Write the actual code instead: Ask AI for an initial version and then refactor it to match your
Go 1.25 is out, so it's a good time to explore what's new. The official release notes are pretty dry, so I prepared an interactive version with lots of examples showing what has changed and what the new behavior is. Read on and see! synctest • json/v2 • GOMAXPROCS • New GC • Anti-CSRF • WaitGroup.Go • FlightRecorder • os.Root • reflect.TypeAssert • T.Attr • slog.GroupAttrs • hash.Cloner This artic
Go 1.24 is out, so it's a good time to explore what's new. The official release notes are pretty dry, so I prepared an interactive version with lots of examples showing what has changed and what the new behavior is. Read on and see! Generic aliases • Weak pointers • Improved finalizers • Swiss tables • Concurrent map • Directory scope • Benchmark loop • Fake time • Test context • Discard logs • Ap
While SQLite provides a certain number of date functions, I wanted something more. So I've created sqlean-time — a high-precision date/time extension with a structured API and a rich set of functions. Note. Adding extensions to SQLite is a breeze. Download a file, run one database command — and you are good to go. Concepts • Creating values • Extracting fields • Unix time • Time comparison • Time
Go 1.23 is out, so it's a good time to explore what's new. The official release notes are pretty dry, so I prepared an interactive version with lots of examples showing what has changed and what the new behavior is. Read on and see! Iterators • Timers • Canonical values • Cookies • Copy directories • Slices • Atomics • Panic traceback • Telemetry • Summary This article is based on the official rel
If you use Timer.Reset() in Go 1.22 or earlier, you may be doing it wrong. Even the book 100 Go Mistakes (which is usually right about Go nuances) got it wrong. Let's see what the problem might be and how to work around it. time.AfterIncorrect solutionReset problem1.23 fixPre-1.23 solutionPost-1.23 solutiontime.AfterFuncFinal thoughtstime.AfterUsing time.After() in a loop in Go ≤1.22 can lead to s
UUIDv7 is a 128-bit unique identifier like it's older siblings, such as the widely used UUIDv4. But unlike v4, UUIDv7 is time-sortable with 1 ms precision. By combining the timestamp and the random parts, UUIDv7 becomes an excellent choice for record identifiers in databases, including distributed ones. Let's briefly explore the UUIDv7 structure and move on to the zero-dependency implementations i
grep is the ultimate text search tool available on virtually all Linux machines. While there are now better alternatives (such as ripgrep), you will still often find yourself on a server where grep is the only search tool available. So it's nice to have a working knowledge of it. That's why is I've created this interactive step-by-step guide to grep operations. You can read it from start to finish
I've been writing code for money for 20 years. I've tried other roles — product management, analytics, testing — but they didn't stick. And over the years, I've learned that I'm pretty dumb. Unfortunately. I haven't been diagnosed with any specific medical condition, but my mental capacity is very limited. I find even easier Leetcode problems challenging. Reading about a basic consensus algorithm
I'm a big fan of interactive code snippets in all kinds of technical writing, from product docs to online courses to blog posts. Like this one: In fact, I even built an open source tool called Codapi1 for embedding such snippets. Typically, a code playground consists of a client-side widget and a server-side part that executes the code and returns the result: browser ┌─────────────────────────────
Go 1.22 is out, so it's a good time to explore what's new. The official release notes are pretty dry, so I prepared an interactive version with lots of examples showing what has changed and what the new behavior is. Read on and see! Loop variables • Range over integers • New random package • HTTP routing • Slices • Version handling • Garbage collection • Summary This article is based on the offici
Writing a package manager is not one of the most common programming tasks. After all, there are many out-of-the-box ones available. Yet, somehow I've found myself in exactly this situation. How so? I'm a big fan of SQLite and its extensions. Given the large number of such extensions in the wild, I wanted a structured approach to managing them. Which usually involves, well, a package manager. Excep
With each major Python release, all the attention goes to the new language features: the walrus operator, dictionary merging, pattern matching. There is also a lot of writing about asyncio and typing modules — they are developing rapidly and are obviously important for the core team. The rest of the standard library modules receive undeservedly little attention. I want to fix this and tell you abo
Generated columns have another great use case. Let's say you decide to keep a log of events that occur in the system. There are different types of events, each with its own set of fields. For example, sign-in: { "timestamp": "2022-05-15T09:31:00Z", "object": "user", "object_id": 11, "action": "login", "details": { "ip": "192.168.0.1" } }
If you are like me, every once in a while you write a useful python utility and want to share it with your colleagues. The best way to do this is to make a package: it easy to install and saves from copy-pasting. If you are like me, you might be thinking that creating packages is a real headache. Well, that's not the case anymore. And I am going to prove it with this step-by-step guide. Just three
English • Russian • Spanish Whether you are a developer, data analyst, QA engineer, DevOps person, or product manager - SQLite is a perfect tool for you. Here is why. A few well-known facts to get started: SQLite is the most common DBMS in the world, shipped with all popular operating systems.SQLite is serverless.For developers, SQLite is embedded directly into the app.For everyone else, there is
このページを最初にブックマークしてみませんか?
『Anton Zhiyanov』の新着エントリーを見る
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く