pragmas for expressions?
Robert Fraser
fraserofthenight at gmail.com
Thu Oct 23 03:55:45 PDT 2008
mgen wrote:
> I have been hacking into the front end as of late and noticed that pragmas cannot be introduced as parts of expressions and instead must be used as a separated statements. My main concern here is sometimes I wish to set up a value that could be returned and used by the code at compile time; for example:
>
> pragma(msg,"you do not have a version set up... please select unix, linux, windows, or mac by entering the name and pressing enter");
> char[] response = pragma(readln);
>
> which could ease the use of things especially build scripts having odd errors that could be corrected at compile time instead of having an entire rerun of the script.
>
> All in all I was wondering what people thought of using pragmas inside of expressions?
The general statement of pragmas for expressions is interesting,
especially as far as compiler intrinsics are concerned.
For your specific use case, use an import expression. With some pipe
trickery in your build scripting, it might be possible to _actually_
make that compilation interactive using import expressions ;-P
More information about the Digitalmars-d
mailing list