HNHacker News
TopNewBestAskShowJobs

ainar-g

3,755 karma · joined June 7, 2015

submissionscomments
ainar-g··on Mildly interesting quirks of C
Are there any practical cases where you'd want "extern void foo"?
ainar-g··on Go Style
Formatting ⊊ Style

Style may also include naming, documentation requirements, recommendations regarding function length, etc.

ainar-g··on Notion AI – waiting list signup
I agree with everything. Notion is essentially unusable for me.

My “favourite” bug is that when you import a markdown document, if you have a piece of inline monospace text that starts with a hyphen, the hyphen will disappear. So, something like this:

  Use the `-v` option to enable verbose mode.
Will render like this:

> Use the v option to enable verbose mode.

A-a-and that's how you get a lot of confused people wondering, if your documentation just sucks.

ainar-g··on Tell HN: Rust Is Complex
I agree that this is a PITA, but this really is more of a growth pain than an initial design flaw. Contexts have appeared way after the Go 1.0, when the entire ecosystem has already gotten used to io.Reader and io.Writer.

If you want a much more annoying example of inconsistency in the initial language design, look at the behaviour of nil and closed channels:

- sending data to a nil channel blocks forever;

- receiving data from a nil channel blocks forever;

- sending data to a closed channel causes a panic;

- receiving data from a closed channel is fine: you receive the zero value, forever.

I can understand the logic behind the last two (sending to a closed channel is an error in program logic, and closing a channel is a common idiom for broadcasting completion of a task to several goroutines), but the first two are just a massive footgun, and, in my opinion, should cause panics instead.

ainar-g··on Why does calloc exist? (2016)
The current C2x (aka C23) draft finally spells the behaviour out explicitly:

> 7.24.3.2 The calloc function

> […]

> Returns

> The calloc function returns either a pointer to the allocated space or a null pointer if the space cannot be allocated or if the product nmemb * size would wraparound size_t.

https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3054.pdf

ainar-g··on In Praise of Plan 9
Good ideas are worth preserving. And preserving these ideas means keeping the discussion alive. Drew mentions in the article that quite a lot of ideas have since ported in one way or another to other unices, but Plan 9 was more than just the sum of its parts. More of a product of its parts, if you will, heh.
ainar-g··on In Praise of Plan 9
Probably so that you could also write additional options for connections, the same way you would with setsockopt. Besides, using connection IDs, and thus having a more or less persistent filename for the current connection, makes it easier for several programs to use the same connection.
ainar-g··on In Praise of Plan 9
I've always wondered. Bell Labs' Inferno, Sun's JavaOS, and Microsoft's Singularity were built on the same principles of OS being almost entirely built on top of a virtual machine, and it's a very interesting idea from many points of view. But all of them seem to have failed to gain enough traction to enter the mainstream.

Was there any reason for that? Were the CPUs not powerful enough, or were the compilers not quite there yet? Or did it have more to do with the business side of things?

ainar-g··on Append data to the url query
Almost quarter of a thousand. Yay!

That does raise an interesting question though. If one wanted to create a command-line tool (or, rather, toolset) as comprehensive as curl, but with a much smaller API surface, how would they go about it? Sure, some of these flags are just shorthands, and some of them could be removed entirely (-o → stdout redirection), but that still leaves a lot of options.

ainar-g··on Intel Finalizes 'Intel on Demand' Pay-as-You-Go Mechanism for CPUs
Next time you're shopping for a CPU, regardless if it's for a personal computer or for a server, consider whether or not you want to support a company that wants to move to this kind of business model. “Intel Creates CPU With Subscription” is something I expected to read on The Onion, not on THG.
ainar-g··on Multiranges in Postgres
https://modern-sql.com/ is another site with compatibility graphs.
ainar-g··on Multiranges in Postgres
I really like PostgreSQL ranges, but I've always been curious, if these are an extension or they are a part of the SQL standard? The “Range Types” page[1] doesn't seem to mention the standard at all, and appendix D.1, “Supported Features”, doesn't mention range types.

The reason I'm curious is because may future SQL database implementations will most likely use the standard at least in some capacity, so it'd be nice to know, how future-proof and DBMS-switch-proof a schema using these could be.

[1]: https://www.postgresql.org/docs/current/rangetypes.html

[2]: https://www.postgresql.org/docs/current/features-sql-standar...

ainar-g··on Yagni Exceptions (2021)
Wikipedia has a couple of non-timeseries examples[1].

I guess with timeseries you'd have something along the lines of:

   user |   time_range |  status 
  ======+==============+=========
      1 | [2018, 2021) | ACTIVE  
      2 | [2019, )     | ACTIVE  
      1 | [2021, )     | BLOCKED 
Where the PK is (user, time_range). (The time_range field being shortened to just year here for simplicity's sake.)

In PostgreSQL you can use the tstzrange[2] type. You could also only store one of the timestamps, but that would come at the cost of more complex queries.

[1]: https://en.wikipedia.org/wiki/Sixth_normal_form#Examples

[2]: https://www.postgresql.org/docs/current/rangetypes.html

ainar-g··on Yagni Exceptions (2021)
Soft deletes can be thought of as a combination of versioning and timestamps. By using the Sixth Normal Form (6NF) with timestamps in the key, you get those for free, but this kind of schema may be a bit too complex for many simpler applications.
ainar-g··on Compiler Explorer
I've only found out recently, thanks to the C++ Iceberg.

https://fouronnes.github.io/cppiceberg/

(Entries are clickable.)

ainar-g··on Evolution of HTTP
From my understanding, the draw is to “start over” and create a completely new hypertext ecosystem where script-heavy advertising-laden sites just aren't technically possible. Or, at the very least, extremely impractical. It's a moonshot, but I guess that's one of the reasons they called it Gemini, heh.
ainar-g··on Prusti: Static Analyzer for Rust
Luckily for you, it's all open-source, heh.

https://github.com/AdguardTeam/AdGuardDNS/blob/master/script...

https://github.com/AdguardTeam/AdGuardDNS/blob/master/script...

There's some mess in there, but if you only need a list of analysers and examples of usage, these should be enough.

ainar-g··on Prusti: Static Analyzer for Rust
I lead a Go team, and we pretty much never go (heh) anywhere without a suite of static analysers. go vet, govulncheck, errcheck, and staticcheck are the required minimum, but we do use some others.

Back when I used to write Ruby, lack of static analysis was a serious problem. I've been able to add Rubocop later, but it's not exactly on the same level as staticcheck, to say nothing about Prusti from the OP.

ainar-g··on Go: Redefining For Loop Variable Semantics
Or you've been using the looppointer analyser[1] from the start, heh.

[1]: https://github.com/kyoh86/looppointer

ainar-g··on Ask HN: How to Stop Caring (Professionally)?
I've been in a very similar situation, and I hate to break it to you, but the best course of action here would be precisely what you imply is not possible. Quit. Autonomy is extremely important for personal and professional growth. Your psyche is correct in letting you know that the situation you're in is not a dignified one for a human.

With that said, the “patch” I've used back when I was in a similar situation was actually to care about the “smaller” things in my work. That is, things that aren't unimportant but are often overlooked. I don't know what job you have, but as a developer, I was able to start experimenting with how we do testing and deploys, improve documentation, think about how I would refactor the codebase if I had the chance. That gave me “internal autonomy”, so to say. Making sure that my skills that can't really be developed would at least not degrade. That helped a lot when I finally quit and found a job with much more autonomy. Finally being able to “do it right” while also having the way to “do it right” right there with me.

ainar-g··on Neovim 0.8 Released
Back in the day, Neovim has always felt about three times snappier than Vim (I think it was Vim 7.2). Also, I don't remember if the newer versions of Vim have it, but Neovim has native LSP support, which is also very nice.
ainar-g··on Gas Leak in the Baltic Sea
> Surely Russia has no interest in sabotaging the pipelines that give them leverage over Europe.

Apart from a false-flag operation by Putin to have a casus belli to start a war with NATO?

Normally, that would be suicide. But Putin has already proven that he, to put it diplomatically, does not see the world the way most sane people see it.

ainar-g··on Reading Soviet Sci-Fi at the End of the World
You can add “The Doomed City” to the list as well. It's an interesting take on the “aliens pull people from different places and times to conduct a social experiment” trope.

https://en.wikipedia.org/wiki/The_Doomed_City

ainar-g··on Wasmtime 1.0
Go issue for adding WASI: https://github.com/golang/go/issues/31105
ainar-g··on A pair of Linux kernel modules using Rust
/proc/config.gz seems to be unavailable to Debian 11, at least by default, but "modinfo 9p" does show the module. Thanks for the clarification!
ainar-g··on A pair of Linux kernel modules using Rust
I did not expect Plan 9, the Linux kernel, and Rust to intersect like that! Would adding this module mean that I could finally mount a 9P filesystem on my Linux machine without the need for third-party software and FUSE?
ainar-g··on Ladybird: A new cross-platform browser project
To those who want to try NetSurf on Ubuntu, I recommend installing from Flatpak. The default Ubuntu package seems to be broken on HTTPS sites; or at least was when I checked it the last time.
ainar-g··on Atkinson Hyperlegible Font
Linus' channel is severely underappreciated. I especially enjoyed his dive into the typography of comedy club logos: https://www.youtube.com/watch?v=XPmlv7cDk6Q.
ainar-g··on Patreon laid off their security team
There are still Ko-Fi, SubscribeStar, as well as YouTube memberships. To say nothing about OnlyFans and Fansly, which have been trying to become less… porn-dependent.
ainar-g··on “UBO Minus (MV3)” – An Experimental uBlock Origin Build for Manifest V3
> How many people use adblockers?

About 43 %, according to [1].

> Is there any chance manifest v3 will lead to enough users abandoning Googles Chrome […]

No. Google Chrome is pretty much in the same position as Internet Explorer used to be. It's the default browser in the most popular mobile OS and the first thing people install on their PC (or get it installed by someone else). Mozilla can barely play catch-up with all the complex web standards pushed by Goog&co., to say nothing about adding killer features that could bring enough users back from Chrome.

Modern web browsers are rapidly approaching the YouTube territory. That is, becoming a technology so complex that only a multibillion-dollar conglomerate can really maintain it without losing money.

[1]: https://backlinko.com/ad-blockers-users

← PreviousPage 3 of 21Next →