HNHacker News
TopNewBestAskShowJobs

OskarS

8,399 karma · joined September 4, 2016

submissionscomments
OskarS··on Donald Knuth's 2024 Christmas Lecture: Strong and Weak Components [video]
On my off hours, I’ve been working through volumes 4A and 4B. They are really wonderful, I highly recommend them. They’re not practical for the vast majority of programmers, but the way he designs and writes about algorithms is remarkable, truly unique. The Dancing Links implementation in 4B in particular (updated significantly from his famous paper) is like a work of art, it’s such an intricate and gorgeous data structure, and blazing fast as well. Man still got it, in his 80s.
OskarS··on PlayAI's new Dialog model achieves 3:1 preference in human evals
I realize it’s hard to face, but it’s ok to admit that (cool as the tech is) some things just have a net negative on the world. It’s just engineers and data scientists using their enormous talents to make world a worse place, instead of a better one.

It’s not going to happen, but the only solution is to just stop developing it.

OskarS··on Fair Pricing
A huge benefit to companies with subscription services is that people forget they have them and keep paying for Ancestry.com or whatever for months (what? no, of course that never happened to me...) after they've stopped using it. Kagi is voluntarily giving up that benefit. This just seems like a consumer-friendly move to me, not sinister at all.
OskarS··on F-strings for C++26 proposal [pdf]
I kinda like it on occasion. Works like pythons defaultdict. Like, if you wanna count something:

    for (const auto &thing: collection) {
        counts[thing]++;
    }
Works nicely, you don't have to check if it's already there before ++ing it. As long as you know that's what operator[] does, it comes in handy more than I would've expected.
OskarS··on F-strings for C++26 proposal [pdf]
Exactly right. There's a huge benefit to encode the ability for compile-time evaluation in the signature of the function itself. Much better than doing it "ad-hoc", like how template instantiation does it. Sometimes it will work, sometimes it doesn't. constexpr functions always work.
OskarS··on F-strings for C++26 proposal [pdf]
They absolutely are not. Look at this range for-loop:

    for (const auto item: vec) { ... }
`item` is not a compile-time constant. It's different every run of the loop.
OskarS··on F-strings for C++26 proposal [pdf]
I agree that I would have preferred destructive moves, but move semantics makes C++ a much richer and better language. I kinda think pre-move semantics, C++ didn't quite make "sense" as a systems programming language. Move semantics really tied the room together.

    const int x = f(); // this is always get evaluated at compile time, (or if it can't, then fail to compile)
That's very silly. You're saying this should fail to compile?

    void foo(int x) {
        const int y = bar(x);
    }
There's no way the compiler can run that, because it doesn't know what x is (indeed, it would have a different value every time you run the function with a new argument). So your proposal would ditch const completely except in the constexpr case, everything runtime would have to be mutable.

So you respond "well, I didn't mean THAT kind of const, you should have a different word for compile-time constants and run-time non-mutability!" Congratulations, you just invented constexpr.

There are many bad things about C++, but constexpr ain't one of them.

OskarS··on F-strings for C++26 proposal [pdf]
> It tries to implement discriminated union in C++ but that feature is lame without true pattern matching. And you can’t implement pattern matching without thorough syntax level support. So in my books it’s in this academic “let’s pretend a while we are using some other language…” category.

I agree, they should have made it a language/syntax feature. However: if you wanna do a sum type, it does do that. I'd rather have that than nothing.

OskarS··on Spaced repetition can allow for infinite recall (2022)
> I'm not arguing for spaced repetition, but the whole point is you do some amount every day (or as needed) for the rest of your life (within reason). So it's not equivalent to get fit/slim quick at all, it's more about disciplined improvement of yourself. If that isn't effective for you don't do it, but based on your comment it seems like you're coming at it from the wrong angle.

Fair enough, I haven't looked into spaced repetition deeply.

I just always got this weird vibe from people talking about it, like they think memorizing all the world capitals was a way to improve your intelligence. It's not.

Same thing with, like, "memory palace" stuff: being able to memorize a deck of cards is probably fun, and it's a nice parlor trick, but it will not help you solve real-world problems, analyze situations, make discoveries or be a better engineer. The way to do that is to just read books, study, work hard in your chosen field and keep up with the latest developments. That is the only way anyone has ever gotten good at anything.

OskarS··on Spaced repetition can allow for infinite recall (2022)
I don't want to rain on anyone's parade, but: of all the really brilliant people I've ever met, interacted with or learned from, I haven't heard of anyone that used techniques like this. Like, the way they learn things and become brilliant is the exact same way every brilliant person has done it for thousands of years: they read books, they discuss and debate with other brilliant people, they study their subjects and work hard. Like, true intelligence is very rarely about rote memorization of facts, it's about making new connections, being creative, and working really hard. There are no shortcuts, you have to put in the work. Aristotle, Leibniz, Einstein or whatever brilliant person you can think of didn't become who they are using cue-cards.

Spaced repetition always seemed like those schemes to get you fit or slim in 30 days that never work. There is exactly one way to get physically healthy, and it's super-unfun: diet and exercise. Same thing with your mind, you have to exercise it and feed it appropriately for months and years. Spend the time you would spend on spaced repetition reading books or watching lectures and doing exercises instead.

OskarS··on C stdlib isn't threadsafe and even safe Rust didn't save us
> it should also offer a new API that simply returns a copy every time

Returning a copy isn't great (memory allocation!), the API should probably be something like:

    int getenv(const char *varName, char *buf, size_t bufSize, size_t *varSize);
Where the caller manages the buffer and getenv writes into it (so it can e.g. be stack or statically allocated), the third argument is the size of the caller-managed buffer, then the last variable is an "out parameter" that returns the "true" length of the environment variable. Then afterwards, you can check if `*varSize > bufSize`, and if so, you need to make your buffer larger. The return value is an error code.

Doing it like this, you can easily implement the "return a malloced copy" if you want to, but it also gives you the option to avoid allocation entirely. This is important for e.g. embedded or real-time applications, or anything that just likes to avoid `malloc()/free()`.

OskarS··on Why is Git Autocorrect too fast for Formula One drivers?
One of my favorite features of std::chrono (which can be a pain to use, but this part is pretty sweet) is that you don't have to specify the exact time unit, just a generic duration. So, combined with chrono literals, both of these work just like expected:

    std::this_thread::sleep_for(10ms); // sleep for 10 milliseconds
    std::this_thread::sleep_for(1s);   // sleep for one second    
    std::this_thread::sleep_for(50);   // does not work, unit is required by type system
That's such a cool way to do it: instead of forcing you to specify the exact unit in the signature (milliseconds or seconds), you just say that it's a time duration of some kind, and let the user of the API pick the unit. Very neat!
OskarS··on Celebrating the timeless allure of Tintin's aesthetics
I would say: skip the early ones. Tintin in the Land of the Soviets and especially Tintin in the Congo are outrageously bad (Tintin in the Congo is horrendously racist). Tintin didn't really become the Tintin we know and love until Blue Lotus, though Cigars of the Pharaoh is still readable.

Like, the parts of Tintin that capture the imagination, the world travel, the realistic depiction of different cultures, the great adventure stories, all of that starts with Blue Lotus.

When people criticize Tintin for being racist, what they're really criticizing are those early stories. In the later stories, the ones that everyone falls in love with, Hergé went to enormous trouble to depict cultures accurately, gathering huge amounts of references to depict everything accurately (you see that in this article, with the image from Blue Lotus). In these stories, almost without exception, Tintin is the champion of colonized and oppressed peoples, and the stories hold up extremely well.

OskarS··on Celebrating the timeless allure of Tintin's aesthetics
I would imagine so. Hergé died in 1983, and the last finished story (Tintin and the Picaros) was published in 1973. I can't imagine its out of copyright.

The first story (Tintin in the Land of the Soviets, a real stinker, this is before Tintin became Tintin) was published in 1930, in Le Petit Vingtième which was the children's edition of the newspaper Le Vingtième Siècle. The newspaper presumably had copyright to the character, but it was shut down in 1940 by the Nazis. After that, Tintin was published in Le Soir (still exists), but I have no idea how the rights transferred. From 1950 onwards, it was published by Hergé's own company.

OskarS··on The Peter Principle still resonates
Yeah, me too. Nobody is born being a great manager. The only way to learn is to actually become a manager and actually do the job.

And you can tell if someone has potential. Like, a good manager needs to be a good communicator, well-organized and a good leader. These are skills you can notice if a person has before promoting them. Similarly going further up the hierarchy.

OskarS··on I'm daily driving Jujutsu, and maybe you should too
The ”staging” concept in git is something that I know really bugs a lot of people, especially beginners with git. Like ”I just want to commit, why is there this extra step?”, but I totally agree with you. Maybe it’s Stockholm Syndrome, but I really like that there’s an extra “look through your changes” procedure before committing, exactly for reasons like this.
OskarS··on Sora is here
Very well put. There's always been this Silicon Valley instinct that all technological advance is always good for humanity, and it's just not that simple.
OskarS··on Python with Rizz
Truly one of the underrated perks of adulthood is deliberately misusing current slang to annoy young people! Put that in your gyatt and vape it!
OskarS··on Message order in Matrix: right now, we are deliberately inconsistent
> (This does mean that clients connected to different homeservers might see different orderings; this is unfortunate but probably unavoidable. But clients connected to the same homeserver should all see the same ordering.)

I don't think it's unavoidable at all, this is exactly the kind of problems CRDTs solve beautifully. If you model your chatting as a CRDT (basically, each message has a Lamport timestamp on it, and you have some sensible way to resolve ties deterministically), then assuming all peers have gotten all messages, the ordering should be perfectly consistent. What may happen is that you type a message, press "enter", and then some message might pop up before that when everyone finally sync, but I think that is acceptible UX, I see version of this in things like Slack and Discord frequently.

All peers having the same message order assuming they all have received the same messages is absolutely required for a chat application in 2024, distributed or not.

OskarS··on Hyrum's Law in Golang
Man, you really can’t escape Hyrum’s Law ever! Now we have people depending on the iteration order being random!
OskarS··on The transition from GIMP 2.x to GIMP 3.0 took two decades
I agree fully, but there’s more than that. It’s just bad marketing! Like, don’t conjure this image into people’s heads when thinking about your product! It seems like they care more about making some juvenile point about how offensive words shouldn’t be a problem rather than the popularity of their thing.

Just find some name that conjures some pretty image like ”GNU Constellation” or whatever and be done with it.

OskarS··on Algol-68 seemed like a good idea
Nicely done! The multi-wprd identifiers with spaces in them is really freaking me out :)
OskarS··on Algol-68 seemed like a good idea
I agree, very readable.

One interesting thing: the sieve array does not have static bounds, the size of it is an argument. Presumably that means it’s stack-allocated dynamically a la ”alloca” (I doubt it’s heap-allocated, given there’s no freeing of it). C didn’t get that feature until C99 and adding it has been almost universally been seen as a mistake.

I imagine that’s an example of one of the many, many things that makes Algol-68 a pain to implement. Does make it easier for the developer though.

OskarS··on SQLite does not do checksums
If you truly believe this, there’s no reason you would want to add checksumming to SQLite either. Either the data you write can be corrupted or it can’t.
OskarS··on SQLite does not do checksums
Honestly seems pretty reasonable to me. SQLite operates above the filesystem, and it seems to me the filesystem is the appropriate place to do this kind of error correction/detection. If you need this kind of durability of your data, why are you storing anything on a filesystem that doesn't do this?
OskarS··on Unix core utilities implemented in Haskell
It is really gorgeously written Haskell. I’ve only dabbled in Haskell, but you’re really shetting my appetite for digging in deeper.
OskarS··on Show HN: Kis.tools – A directory of tools that work
Site doesn't work right in Firefox, the text is all cut off in the sidebar. First time I've seen that in a while!
OskarS··on M4 MacBook Pro
Yep, the same, M1 Pro from 2021. It's remarkable how snappy it still feels years later, and I still virtually never hear the fan. The M-series of chips is a really remarkable achievement in hardware.
OskarS··on ElasticSearch and many other repos are gone
If it's a serious enough issue, GitHub staff can almost certainly still step in and manually restore all that stuff if needed.
OskarS··on Comparison of configuration file languages (2016)
> but generally I just want a set of knobs to tweak behaviour.

But you can do that so easily as well! Like, take this YAML (substitute equivalent JSON or TOML, specific configuration language is irrelevant):

    options: 
      someOption: 14
      nested:
        foo: "some string"
        bar: true
I don't see how that's so much easier than this version in Lua:

    options = {
        someOption = 14,
        nested = {
            foo = "some string",
            bar = true
        }
    }
And when you do need to get a bit more complex, you have the the tools to manage that complexity. Like, if you have a bunch of very similar things (say, job definitions in CI/CD), you want a way to not repeat yourself so you only have to edit that once, YAML has a tool for that, "anchors" [1]. But it's obscure and a bit hard to use. In a real programming language, it's trivial: just stick the repetitive parts in a variable and use that. Or define a simple function in case most of the stuff is repeated, but some is not, so you can do

    foo = generateRepetativeConfig('specificOption')
Or maybe you can just do that with a simple for-loop. And if you want to do something like a string substitution, you have a whole dang language with the tools you need to do it.

Dhall and languages like that are a big improvement, but really, I just want a normal programming language. We have decades of experience now with managing complexity in computer systems, and programming languages have evolved robust systems for handling that.

I agree that sandboxing and security can be a real concern for some of this stuff, in which case Starlark is perfect, though you can sandbox languages like Lua or various Lisps as well.

[1]: https://support.atlassian.com/bitbucket-cloud/docs/yaml-anch...

← PreviousPage 7 of 34Next →