Is old style compile-time foreach redundant?

Seb seb at wilzba.ch
Wed Jan 10 00:49:04 UTC 2018


On Tuesday, 9 January 2018 at 23:27:42 UTC, H. S. Teoh wrote:
> On Wed, Jan 10, 2018 at 12:18:46AM +0100, Timon Gehr via 
> Digitalmars-d-learn wrote:
>> On 09.01.2018 22:04, H. S. Teoh wrote:
>> > [...]
>> 
>> I think "if (0 == 3) { static break; }" should be a 
>> compile-time error.
>
> That's also a possible solution, perhaps a better solution than 
> what I described.  Make it so that static break/continue cannot 
> be nested inside runtime conditionals.  That should exclude all 
> of the pathological cases, hopefully.
>
>
> T

FWIW I recently bumped into a problem where `static break` would 
be _really_ useful:

https://github.com/dlang/dmd/pull/7577#discussion_r159175229


More information about the Digitalmars-d-learn mailing list