in reply to Re: statement vs. block?
in thread statement vs. block?

No it's not syntactic ambiguites I'm looking for. lodin's got the gist and a couple of good examples below. I'm looking for cases where the contents of a block form, is legally acceptable with the expression form, but would behave differently in some way.

It's mostly intellectual curiosity. I prefer the syntax of the block version of map and grep, but for really trivial expressions with high iteration counts, the introduction of a block can have a measurable, and even significant effect on performance.

I got to wondering if it would be possible to recognise when a block was equivalent to an expression (statement) and have the compiler do away with the push/pop of scope.

Then I got to thinking about whether there are other places where both block and expression forms exist and what would be the effect of this kind of optimisation on them. And then ... I asked the question :)


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."