jcelerier 10 days ago

Who says that the one line lambda is less clear that a convoluted 10-line mess doing dumb stuff like if(fooIsTrue) { map["blah"] = bool(fooIsTrue); } else if (!fooIsTrue) { map["blah"] = false; }

1
johnnyanmac 10 days ago

My experience in unmanaged legacy code bases. If it's an actual one liner than sure. Use your ternaries and closures. But there is some gnarly stuff done in some attempt to minimize lines of code. Most of us aren't in some competitive coding organization.

And I know it's intentional, but yes. Add some mindfulness to your implementation

Map["blah"] = fooIsTrue;

I do see your example in the wild sometimes. I've probably done it myself as well and never caught it.