adding static return?
Nicolas Sicard
dransic at gmail.com
Tue Mar 4 01:29:26 PST 2014
On Monday, 3 March 2014 at 23:27:42 UTC, Xavier Bigand wrote:
> I thought it could be nice to have a static return.
>
> My Idea is to remove unnecessary bracket encapsulation made
> with some static if statements.
>
> It will works like this :
>
> module xxx.opengl;
>
> import buildSettings; // contains some global constants
>
> static if (renderMode == directX)
> return;
>
> ...
>
>
> So there will no more need to scope the module code and indent
> it.
>
> Is it a good idea?
This is just to avoid brackets and the compulsion of indenting
inside them, isn't it? ;-)
Version blocks can be used with colons (see
http://forum.dlang.org/thread/lep2p3$2765$1@digitalmars.com for a
caveat). May be this syntax could be extended to module-level
static ifs. D would look more and more like Python...
More information about the Digitalmars-d-learn
mailing list