Thank you for sharing, Laurent!
Thank you for sharing, Laurent!
How to implement "defer" keyword in C (allows to free memory and other resources correctly): implementations with C23/GCC, C11/GCC, GCC/Clang... - Blog Post by Anton Zhiyanov @antonz.org #Programming antonz.org/defer-in-c/
What makes modern systems languages stand out? Many things โ but allocators are a big one.
Let's explore how Rust, Zig, Odin, C3, and Hare design their allocators, and then build one in C!
antonz.org/allocators
Go 1.26 is out, and the announcement says:
"Over the next few weeks, follow-up blog posts will cover some of the topics in more detail. Check back later."
So you can wait a few weeks OR you can read my interactive Go 1.26 tour right away:
antonz.org/go-1-26
SwissTable, a high-performance open-addressing hash map originally developed by Google, is becoming more popular in the industry.
First, Rust adopted it for its HashMap type. Then Go started using SwissTable for its map type.
And now โ Valkey. Pretty cool!
valkey.io/blog/new-has...
Fancy an allocator in C? It's not Zig, but it's honest work.
We don't need to wait for "defer" to be added to the C standard. We already have defer at home!
antonz.org/defer-in-c
The only two features I really miss in C at this point are namespaces and defer.
With Go 1.26, you can easily log to multiple targets (like stdout, a file, or a remote server) using just the standard library.
All thanks to slog.MultiHandler, which sends log records to any number of handlers you configure.
When I first saw Go's interfaces, I was instantly sold. I didn't care that the language didn't have enums or generics โ Go's interfaces were love at first sight!
Who says we can't have nice things in C?
antonz.org/interfaces-i...
With Go 1.26, you can peek into a byte buffer if you're that curious.
The new Buffer.Peek method in the "bytes" package returns the next N bytes from the buffer without advancing it.
The slice returned by Peek is not a copy; modifying it changes the buffer.
I like how the Odin folks went, "Package management? Nah. Just copy and vendor them." ๐ Brutal, but fair.
I think it's the first time in Go's standard library that a number of public APIs have started behaving this way. It is justified, but still kind of sad.
Starting with version 1.26, most crypto APIs will simply ignore the reader parameter and use an internal system random source instead.
You can pass nil or a reader โ it doesn't matter anymore:
ecdsa.GenerateKey(elliptic.P256(), nil)
These APIs don't guarantee how they use random bytes from the reader. Algorithm updates can change the sequence or amount of data read. So, applications that rely on specific behavior may break when the implementation changes.
The Go team chose a radical way to solve this problem.
The most controversial change in Go 1.26 is probably the "reader-less" cryptography.
Current cryptographic APIs, like ecdsa.GenerateKey, often accept an io.Reader as the source of random data:
ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
Based on the conversation, this one will probably get rejected too. I also don't think it's a good idea to add UUID string (!) generation methods to crypto/rand.
Very interesting, thank you! It's definitely hard to see all these nuances from the outside, being just a SIMD bystander.
Oh wow, another one :) I think I've seen several of these get rejected.
The invention of the X-ray permanently changed medicine.
But was it wise to use X-rays for entertainment, shopping, and beauty treatments? Not really.
AI skepticism (not luddism) is the healthiest attitude for now.
Yeah, my bad. Thanks!
I was a bit confused because the author talks about finding transitive dependencies in the article (at the graph level, not in the source data), but then moves on to the final statistics without including them.
Well, it must be bcrypt then! Everyone loves bcrypt, right? :)
They are probably transitive dependencies of other high-profile third-party packages like Gin.
Thanks :) I also tried building fake simd/amd64 and simd/arm64 myself. I like this setup better than having just one simd/archsimd package, but after trying both, I think either option works.
I'm definitely not a fan of the "package per vector size" approach ๐
Source: blog.thibaut-rousseau.com/blog/the-mos...
So the second most imported 3rd-party dependency is Google's own UUID package. I wonder what it would take to convince the Go team to add it to stdlib.
Also, I don't think x/crypto and x/net should be here at all. Both are imported by stdlib itself, so they're basically included in every project.
Yes, this is more verbose than just having a single simd/archsimd with conditional logic in the client code to pick the right type.
But to me, this seems clearer and easier to maintain.
My idea was to have simd/amd64 and simd/arm64 with distinct types, each package reflecting the CPU architecture (AVX/Neon) without even trying to be portable.
Then the user would create, for example, an Add function with two different implementations governed by build tags.
The phrase "vector types will be defined on the architectures that support them" is what I'm talking about.
I interpret it as "some archsimd types will be available on amd64 and some on arm64."
In my opinion, this is less clear than having separate packages with partly overlapping type sets.
Yes, the methods map to AVX instructions very closely.