Scott Meyers' DConf 2014 keynote "The Last Thing D Needs"
Dmitry Olshansky via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Thu May 29 15:19:59 PDT 2014
29-May-2014 23:29, Walter Bright пишет:
> On 5/29/2014 11:11 AM, Dmitry Olshansky wrote:
>> Static if is certainly NOT an attribute, it doesn't make any sense.
>
> Yes, it does make sense. It was not an accident that the frontend treats
> it as it does, the code to do it was deliberately put there.
With the reason being? I could deliberately put any code anywhere.
> The attributes are all designed to affect a block of code - so are
> version/debug/staticif - why should they be different?
Because they are different constructs?
static if models if-else, so does the version statement BTW (else
version). debug doesn't model if-else. I could see *some* common ground
between them.
safe/pure/nogc etc. are different in that they all affect symbols and
have no conditional clause, *some* of them even have counterparts
(consistency? - I do not see any).
This for instance doesn't work:
static if(1):
int blah;
else
{}
while this does:
static if(1)
int blah;
else:
Does it make any sense? To me - no, not at all.
Not every decision must be taken on the grounds of making some code in
compiler more straightforward.
After all C's #include was so simple to implement and we know where this
way leads to.
--
Dmitry Olshansky
More information about the Digitalmars-d-announce
mailing list