What's that 'q' before '{' in this code?

Machine Code jckj33 at gmail.com
Tue Jan 15 17:59:30 UTC 2019


On Tuesday, 15 January 2019 at 17:56:10 UTC, SrMordred wrote:
> On Tuesday, 15 January 2019 at 17:52:35 UTC, Machine Code wrote:
>> https://github.com/dlang/dmd/blob/master/src/dmd/compiler.d#L75
>
> https://dlang.org/spec/lex.html#token_strings
> :)

I had just infered from the commend in the code "The D code to be 
generated is provided as D source code in the form of a string."

then I tried:

	auto s = q{ foo(); return 10 };
	writeln(s);

Then whoa. What a feature! I'm not aware of any language with 
this feature. Amazing.
Thank for your answer as well :)


More information about the Digitalmars-d-learn mailing list