pragmas for expressions?

Ary Borenszweig ary at esperanto.org.ar
Wed Oct 22 10:45:57 PDT 2008


Gregor Richards wrote:
> 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?
> 
> Pragmas in expressions: Could be useful, but I'd have to see a good use 
> case.
> 
> The use case you provided: Disgusting, offensive, makes me want to find 
> you and break your fingers. Compilation is a NON-INTERACTIVE PROCESS. 
> Repeat that to yourself.
> 
>  - Gregor Richards

I think it can be very amusing. Some example messages:
  - lol, I think you forgot a semicolon there. This is the time number 
2345 you do this, you keep surprising me! Do you want me to add that for 
you?
  - Hmm... it seems this is taking too much. Would you like to play 
Tetris meanwhile? Maybe remove some random pieces of code to speed up 
things?



More information about the Digitalmars-d mailing list