NHacker Next
  • new
  • past
  • show
  • ask
  • show
  • jobs
  • submit
▲Why Pendulum had to write the most cursed "+" operator in all of Python (dev.arie.bovenberg.net)
jonathaneunice 40 minutes ago [-]
OMGeeeee!

I too have plumbed the call stack for hidden-maybe-forbidden knowledge from the caller, and it is always fraught. No matter how good one's intentions. Forget dynamic type testing. Forget Perl's `wantarray` dynamic introspection of "what does the caller want?" Those are small potatoes. This is full on "who's calling me and what do I want to send back as a result?" The people who will never forgive you for type testing are going to straight-up excommunicate whoever wrote this! And yet...it makes complete sense. Based on the promises made, you have to do something... and you're already in "what is the least of the evils?" territory, because you're going to have to do something that someone—maybe a lot of someones—will call evil.

My admiration for Pendulum just increased. This is sin-eating.

leni536 32 minutes ago [-]
It's the promises that don't make sense, although that might be obvious in hindsight.
ariebovenberg 1 days ago [-]
Author here. I ran into this while comparing Pendulum with `whenever`, the datetime library I maintain. I sent a patch that removes the hack, but the post is about why the underlying design can't be patched the same way. Happy to answer questions.
LoganDark 43 minutes ago [-]
Did you use LLM to write parts of the article?

> The trouble with guessing who’s calling is that you can’t anticipate every caller. Pendulum’s hard-coded check is fragile: it covers only one name, and relies on an exact call stack that Pendulum doesn’t control.

Edit: it looks like the later parts of the article show a lot of LLM tells, but not the beginning. I've been seeing this pop up more and more lately...

throwaway89201 12 minutes ago [-]
> but not the beginning

You didn't stop reading after "The hack itself is on its way out, but the design behind it still matters for your code"? I did.

david2ndaccount 29 minutes ago [-]
"In the face of ambiguity, refuse the temptation to guess."
Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact
Rendered at 21:18:51 GMT+0000 (Coordinated Universal Time) with Vercel.