Are non-scoping `begin ... end` blocks useful?

You’re right — it’s not common that you need to group expressions in a manner that wouldn’t be better expressed by another language construct. The big exception is macros and metaprogramming. For example, you might want to add timing to some chunk of code without changing its semantics. @time begin ... end is a simple answer.

Other macros explicitly expect a begin/end construct. It’s the way to create a “block-like” syntax with macros.

10 Likes