this post was submitted on 15 Sep 2025
81 points (88.6% liked)

Programmer Humor

38737 readers
78 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 6 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] voodooattack@lemmy.world 3 points 1 month ago* (last edited 1 month ago) (1 children)

The problem is that lambdas with a capture ~~aren’t strongly typed~~ are uniquely typed, so you have to use decltype/auto. And if you pass such a lambda to a function you’ll have to use auto as well.

If you write a lambda with a capture that calls itself recursively you’ll have to pass it to itself as an auto argument as part of the call signature.

I think this article explains it better: https://artificial-mind.net/blog/2020/09/12/recursive-lambdas

Edit: fixed wrong terminology

[–] barubary@infosec.exchange 2 points 1 month ago (1 children)

This is an entirely new way to misuse "strongly typed" that I was not aware of before. Amazing.

Thank you!

[–] voodooattack@lemmy.world 3 points 1 month ago

You’re welcome. Just don’t blame me when your brain starts cursing in foreign languages you don’t even know. ;)