Mixins: to!string cannot be interpreted at compile time

bearophile bearophileHUGS at lycos.com
Tue Mar 1 04:42:59 PST 2011


Peter Lundgren:

> I'm trying to use mixins to generate an array of numbers that are coprime to a
> statically known value. I've tried the following, but I receive the error:
> 
> Error: to(i) ~ ", " cannot be interpreted at compile time

Currently to!() can't run at compile-time.
Are you sure you need string mixings? Isn't compile-time run of functions enough for you?

If you really want to create that at compile-time as string, you are able to use the ToStringNow, converting makePossibleAValues into a recursive template, and running coprime() at compile-time from the template. But it will eat lot of RAM at compile-time.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list