proposal: a new string litteral to embed variables in a string

Dmitry Olshansky dmitry.olsh at gmail.com
Wed Nov 6 10:49:56 PST 2013


06-Nov-2013 21:40, Manu пишет:
> On 7 November 2013 03:14, Dmitry Olshansky <dmitry.olsh at gmail.com
> <mailto:dmitry.olsh at gmail.com>> wrote:
>
>     06-Nov-2013 15:45, Dicebot пишет:
>
>         Reasonable proposal but I have not encountered much need in this
>         functionality personally (std.string.format worked just fine)
>         and thus
>         can't really evaluate how justified such addition may be.
>
>
>     +1
>
>     Since formatting/templates became accessible in CTFE I do not see
>     much need for this.
>
>
> Every time I use a q{} block, it's to embed some code in a different
> language. I would like the IDE to syntax hilight properly if able.
> HLSL/GLSL, JSON, XML are the most common embedded languages I encounter.

Depending on editor/IDE a decent macro/extension would detect specific 
function before the q{}. Say:
hlsl!q{

};

And highlight it as appropriate.

I think it's customary for good editors to highlight parts of code based 
on different scheme (say PHP/JS mixed in the HTML highlights just fine). 
So the basic blocks must be there already.

All in all it's hardly a good thing to trade a language feature *only* 
to help people give "hints" to IDEs (which they may as well ignore).

-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list