code folding

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Mar 14 13:56:02 PDT 2017


On 03/13/2017 10:29 AM, Inquie wrote:
> Does D have any nice way to specify a block for cold folding? I have a
> very large set of structs and I'd like to be able to code fold them all
> at once and together.
>
> I have been using
>
> static if(true)
> {
>     ... junk
> }
>
> but the static if is uninformative since that is the only line that is
> shown when folded. A comment helps but still kinda ugly.
>
> C# has #regions and hopefully D has something as useful.
>

There is version:

version (all) {
     // ...
}

You can define your own version identifiers as well:

version = some_descriptive_name;

version (some_descriptive_name) {
     // ...
}

Ali



More information about the Digitalmars-d-learn mailing list