On Thursday, 29 September 2016 at 00:35:47 UTC, Walter Bright wrote:
I agree with Steven. Having the 'else' continue on with a scope that is already closed by } is very weird and unsettling.

Seconded

But it is conditional compilation, and no other way around it has been proposed, and it has major benefits. (C++'s static if proposal does not allow this, a decision that I predict they'll come to regret.)

The C++ static_if will create a new scope? Huge mistake IMO. The fact that the static if doesn't create a new scope is a trick that's used a lot in D and Phobos specifically.

Case in point: https://github.com/dlang/phobos/blob/a5e935370f5de590532bb5d12610c865343f56a9/std/string.d#L5859

Adding more cases of this sort of thing should be approached with great trepidation, and is not justified if it is only a minor improvement.

I agree; static if is different because it's a compile time feature and not a run time feature.

Reply via email to