mixin does not work as expected

rempas rempas at tutanota.com
Wed Jan 5 09:17:54 UTC 2022


On Wednesday, 5 January 2022 at 09:02:53 UTC, vit wrote:
> Try this:
> ```d
> pragma(msg, type_check!("static if", "i8", "true", "5", "4", 
> "10", "5"));
> ```
>
> Result:
>
> ```d
> static if(is_same!(num, i8)) {
>     mixin(base_digit!("5", "4", "10", "5"));
>     static if (true) {
>       mixin(overflow_check!"i8.min"); }
>   }
> ```
> is_same - is undefined
> i8 - is undefined
> overflow_check!"i8.min" - ?
>
>
> This code with mixins is horrible :)

Hi and thanks for your time. "pragma(msg, ...)" will indeed work 
but it will print the code in the standard output. Is there 
something that I'm missing?


More information about the Digitalmars-d-learn mailing list