New thing I learned for the day

Timon Gehr timon.gehr at gmx.ch
Tue Nov 26 16:02:26 UTC 2019


On 26.11.19 16:50, Steven Schveighoffer wrote:
> On 11/26/19 10:35 AM, Adam D. Ruppe wrote:
>> On Tuesday, 26 November 2019 at 15:28:38 UTC, Steven Schveighoffer wrote:
>>> Did you know this was valid syntax? I didn't.
>>
>> I did not know already, but it is no surprise to me either because the 
>> colon works on almost every other attribute like that too... static if 
>> and version are similar according to teh grammar.
> 
> static if and version are not attributes. But actually, I didn't know 
> that it works with version as well. Seems to also work with a debug 
> condition according to grammar.
> 
> What's weird is that it doesn't work in a function, but I guess those 
> are considered a different part of the grammar.  In any case, I probably 
> will not be using it. But I did a double take when I saw it...
> 
> -Steve

static foreach(i;0..10):

pragma(msg, ":P");
pragma(msg, "!");


More information about the Digitalmars-d mailing list