3 ms·
The thing is, naked scope blocks are missing the main reason I'd use a nested function: the ability to be named. I do occasionally use scope blocks when I want
by Sindisil 10y ago
The thing is, naked scope blocks are missing the main reason I'd use a nested function: the ability to be named.
I do occasionally use scope blocks when I want to constrain the scope of one or more local variables, and there isn't an otherwise appropriate scope already created by a flow control construct.
- majewsky 10y agoI also use naked scope blocks sometimes. To me, their main purpose is to make temporary variables go out of scope, to clarify which variables are still intentionally live beyond the block.