Trip notes from Israel
Adam D. Ruppe via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Mon May 22 08:23:21 PDT 2017
On Monday, 22 May 2017 at 15:05:24 UTC, Andrei Alexandrescu wrote:
> mixin is a statement so it needs a terminator, hence
> the semicolon at the very end. In turn, mixin takes
> a string (the concatenation of variable op
That actually depends on context! The mixin statement needs
statements, but the mixin expression takes expressions. Same
mixin keyword, but if it is in the context of a statement it is a
statement and in the context of an expression, it is an
expression.
---
void main() {
int payload;
mixin("++payload;"); // statement, ; required
int b = mixin("++payload"); // expression, ; would be wrong
there and cause an error!
}
---
http://dlang.org/spec/expression.html#MixinExpression
http://dlang.org/spec/statement.html#MixinStatement
More information about the Digitalmars-d-announce
mailing list