The unofficial purpose is to introduce the term “region” for a brace-delimited section of code that does not introduce scope. For example, static foreach
and static if
don’t govern a block, they govern a region. The actual DIP idea is to introduce a construct to make a pair of braces to denote a region anywhere the programmer sees fit.
The idea is simple: pragma(region) { … }
is a region, which means the braces don’t introduce a block with scope. In any reasonable editor, it can be collapsed.
Parsing a region is fairly simple: Pretend it’s not really there, akin to a comment. Speaking of comments, you can use a comment to name a region:
pragma(region) // operators
{
}
or
pragma(region) /+ operators +/ {
}
The biggest difference to #pragma region
of MSVC or C# is that those are ended with #pragma endregion
and that allows them to be non-nesting.