[Issue 4428] string mixin of variable of type string fails

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jul 5 06:07:26 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4428


yebblies <yebblies at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies at gmail.com
         Resolution|                            |INVALID


--- Comment #1 from yebblies <yebblies at gmail.com> 2010-07-05 06:07:22 PDT ---
String mixins only work when the string is known at compile time.
Initializing from a variable won't work because the value is not known until
run time.
String literals are known at compile time, and the function call is evaluated
using ctfe.
Maybe what you're looking for is enum?

void main()
{
    enum string str = "writeln(\"hello world\");";
    mixin(str);
}

This is not a bug, variables cannot be used at compile time.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list