When not capturing the return value of a string mixin expression, I get "found `End of File` when expecting `;`"
H. S. Teoh
hsteoh at qfbox.info
Fri Sep 12 17:56:00 UTC 2025
On Fri, Sep 12, 2025 at 03:41:15PM +0000, realhet via Digitalmars-d-learn wrote:
> On Friday, 12 September 2025 at 15:28:58 UTC, Monkyyy wrote:
> > On Friday, 12 September 2025 at 08:36:42 UTC, realhet wrote:
> > > Hi,
> > >
> > > ```d
> > > import std;
> > >
> > > [...]
> >
> > It's seeing the eof of the mix file no?
>
> This is the smallest example so far:
> ```d
> import std;
>
> void main() {
> ( mixin("(()=>1)()") ); //it compiles and runs.
> mixin("(()=>1)()") ; //Error: onlineapp.d-mixin-5(5): Error: found
> `End of File` when expecting `;` following expression
> }
> ```
>
> What I learned today is that the second mixin wants a statement and does not
> accept an expression. It didn't liked the EOF which is appeared at the end
> of the mixin text.
Add a semicolon at the end of the mixin string, and it should work.
T
--
If anyone wants a copy of Orthopedics Today, I have back issues.
More information about the Digitalmars-d-learn
mailing list