issue with static foreach

Basile B. b2.temp at gmx.com
Thu Jul 22 10:01:59 UTC 2021


On Thursday, 22 July 2021 at 05:57:02 UTC, jfondren wrote:
> On Thursday, 22 July 2021 at 03:43:44 UTC, someone wrote:
>> ... it compiles no-more: Error: found `End of File` when 
>> expecting `}` following compound statement
>>
>> ... what I am doing wrong ?
>
> You'll get the same error from this code:
>
> ```d
> unittest {
>     mixin("{");
>     mixin("}");
> }
> ```
>
> https://dlang.org/spec/statement.html#mixin-statement
>
>>The text contents of the string must be compilable as a valid 
>>StatementList, and is compiled as such.
>
> Each individual string has to compile on its own. You'll have 
> to concatenate strings and then mixin them.

There was a similar issue on bugzilla, and the consensus for 
closing is that mixins are not supposed to introduce scopes (or 
unmatched scopes, let's say).

See https://issues.dlang.org/show_bug.cgi?id=3858#c4

However the specs are indeed not up to date with that.


More information about the Digitalmars-d-learn mailing list