3 ms·
… > excluding the special case of low-level languages with capture clauses Of course it works, you're specifically capturing `i` by value. It's not exactly su
by masklinn 7y ago
…
> excluding the special case of low-level languages with capture clauses
Of course it works, you're specifically capturing `i` by value. It's not exactly surprising that doing things completely differently yields a different result.
- gpderetta 7y agoTo be fair I missed the note at the end of your commend on my first read. Still, in the specific C++ example, no other capture clause is valid. Also, python could have chosen a slightly different closure semantics and preserved sanity: instead of closing over the binding itself, it could close over each object reference separately (exactly in the same way the default parameter hack works).