Readit News logoReadit News
benhoyt commented on Ask HN: What are you working on? (May 2025)    · Posted by u/david927
jkoff · 3 months ago
I can't help but point out the irony of a chess program written in Go, as someone that enjoys playing Go [1] myself. Sorry to hear it wasn't that fun, hope you still got something out of it!

[1] https://en.wikipedia.org/wiki/Go_(game)

benhoyt · 3 months ago
Yes, definitely still got/getting something out of it, thanks. And I'll probably get more out of it when I read up on "how to write a real chess program" for v2, and learn about all the things I didn't think about.
benhoyt commented on Dependency injection frameworks add confusion   rednafi.com/go/di_framewo... · Posted by u/ingve
jaza · 3 months ago
As a (mainly) Python dev, I'm aware that there are DI frameworks out there, but personally I haven't to date used any of them.

My favourite little hack for simple framework-less DI in Python these days looks something like this:

    # The code that we want to call
    def do_foo(sleep_func = None):
        _sleep_func = sleep_func if sleep_func is not None else time.sleep

        for _ in range(10):
            _sleep_func(1)

    # Calling it in non-test code
    # (we want it to actually take 10 seconds to run)
    def main():
        do_foo()

    # Calling it in test code
    # (we want it to take mere milliseconds to run, but nevertheless we
    # want to test that it sleeps 10 times!)
    def test_do_foo():
        mock_sleep_func = MagicMock()
        do_foo(sleep_func=mock_sleep_func)
        assert mock_sleep_func.call_count == 10

benhoyt · 3 months ago
Yeah, I use this sometimes too (even though Python makes "monkey patching" easy). However, note that it's simpler and clearer to use a default value for the argument:

  def do_foo(sleep=time.sleep):
    for _ in range(10):
      sleep(1)

benhoyt commented on Ask HN: What are you working on? (May 2025)    · Posted by u/david927
benhoyt · 3 months ago
A program that will play chess (written in Go). My 18yo daughter can now beat me at chess (not that I'm any good). I figured if I can't beat her, I'll see if I can write a program to beat her instead. My idea for v1 is that I'd write the algorithm myself, without looking up anything about how to write a chess program (I'm sure such literature abounds). I've just about finished v1; still a few bugs to iron out. To be honest, I didn't find it all that fun, mainly because of all the special cases (all the castling rules and the like).
benhoyt commented on Good Writing   paulgraham.com/goodwritin... · Posted by u/oli5679
yojo · 3 months ago
Reminds me of a line by Douglas Adams describing some particularly crude alien invaders:

“The ships hung in the sky in much the same way that bricks don’t.”

He could have written something like: “The blocky ships hovered seemingly in defiance of gravity.”

Instead he picked a phrasing that’s intentionally a little hard to parse, but the reader feels clever for taking the time to get the joke, and remembers it.

Paul’s style of removing all friction might help the concepts slide smoothly into one’s brain, but as antirez points out, they’re less likely to stick.

benhoyt · 3 months ago
> “The ships hung in the sky in much the same way that bricks don’t.”

That is probably my favourite phrase from the whole book. For some reason I find it hilarious. It has stuck in my brain in much the same way that names don't.

benhoyt commented on The self-castrated hatmaker who killed John Wilkes Booth (2015)   washingtonian.com/2015/04... · Posted by u/rathertrue
cyberpunk · 4 months ago
> His rash tendencies exhibited themselves in strange ways. One day while he was ministering in the summer of 1858, Corbett was ogled by a pair of prostitutes, and the lower half of his body responded invitingly. He went home, took a pair of scissors, snipped an incision under his scrotum, and removed his testicles, then headed out to a prayer meeting.

> In the Bible, Matthew 19:12 quotes Christ as saying “there are eunuchs who have made themselves eunuchs for the sake of the kingdom of heaven.” Corbett made himself a eunuch and didn’t check himself into Massachusetts General Hospital until he’d finished his prayers, had a full dinner, and taken a light stroll through the city that evening.

whelp. Thats enough internet for me today...

benhoyt · 4 months ago
The guy certainly had ba... uh, courage. Jesus is known for saying striking things, like "If your hand or your foot causes you to stumble, cut it off and throw it away. It is better for you to enter life maimed or crippled than to have two hands or two feet and be thrown into eternal fire." (Matthew 18:8) He was the master of attention-grabbing metaphor. Of course here he means "deal seriously with your sin", not "get out the butcher's knife".
benhoyt commented on Ask HN: How do you make a living contributing to and/or creating OSS projects?    · Posted by u/Brysonbw
benhoyt · 5 months ago
I do it by working for Canonical. The vast majority of our projects are open source. Yes, Canonical's application process is very long and thorough, but it's a good company to work for. Those aren't "my" projects, of course; I'm still very much working for an employer, but it's nice that our development effort is in the open and freely available. I also maintain a few of my own open source projects, for which (via GitHub Sponsors) I get about enough for one coffee date with my wife.
benhoyt commented on Fly.io outage – resolved   status.flyio.net... · Posted by u/punkpeye
beezlewax · 9 months ago
Do you mind if I ask what monitoring service that is?
benhoyt · 9 months ago
Sure, it's UptimeRobot: https://uptimerobot.com/
benhoyt commented on Fly.io outage – resolved   status.flyio.net... · Posted by u/punkpeye
benhoyt · 9 months ago
My fly.io-hosted website went down for 5 minutes (6 hours ago), but then came right back up, and has been up ever since. I use a free monitoring service that checks it every 5 minutes, so it's possible it missed another short bit of downtime. But fly.io has been pretty reliable overall for me!
benhoyt commented on Go Turns 15   go.dev/blog/15years... · Posted by u/zdw
mathw · 9 months ago
We do have to acknowledge Go's significant influence on language tooling. I'm not sure my own joy in Rust's tooling would be in the same place at all if we didn't have Go there shipping package management and autoformatting out of the box. Autoformatting - what a revolution in creating a language community where that's a standard, required part of the workflow! What an entire class of pointless arguments that's helped to eliminate. Marvellous.

I'm glad I turned down a job working in Go though. Whenever I read some open source tool's code to find out what it does, anything in Go seems unnecessarily verbose and extremely simplistic. It's all the design principles of Java that I don't like, but more of it. Not my style, but an undeniable positive impact elsewhere also.

And to some extent the idea that we can have modern languages with modern tooling which compile to native code and run really fast is much perpetuated by Go, and this is highly valuable in a world where far too many things are written in JavaScript and bundled with a web browser to render them because that's "easier".

benhoyt · 9 months ago
> It's all the design principles of Java that I don't like, but more of it.

I'm curious what you're referring to there. I think of Go as the "anti-Java". Where Java has "org.apache.commons.httpclient", Go has "net/http". Where Java has stuttering like "final Logger logger = LogManager.getLogger();", Go has "logger := log.New()" (and no log4j vulnerablity). A typical "simple" app in Java puts files in "src/com/username/simplewebapp/subdir", typical Go project structure is to put files in just "subdir", or even just in the root dir. And so on.

u/benhoyt

KarmaCake day7149February 21, 2007
About
Software engineer at Canonical. Author of GoAWK, a POSIX-compatible AWK interpreter with CSV support (written in Go). Author of Python's os.scandir(). Husband, father, Christian. See my personal website: https://benhoyt.com/
View Original