Heh. I'd rather want text editors to use syntax highlighting on comments as well, but use a different background color. Then I would know it's a comment but it would also make any embedded code in the comment actually readable.
bearophile < [email protected]> Wrote: > Andrej Mitrovic: > > > I'm sorry, but what does q{..} mean? > > q{} is just a different syntax to write "" or `` > > It's a controversial feature. q{} isn't recognized by editors as a string, so > they colour the syntax it contains normally as code, and not as a string. So > it's a bit useful if you want to give a string to a higher order function > like map, instead of a delegate, and you want to keep the visual illusion of > a delegate: > > map!q{a * a}([1, 2, 3]) > > The problem comes straight from its purpose: is that it doesn't look like a > string, so its true nature is a bit hidden; and this may cause some troubles. > > Another possible problem was discussed when the q{} syntax was introduced. > It's not a clean syntax, it's a hack from the point of view of parsing/lexing > too. > > It's handy, but it may cause troubles too. I am getting used to it, but it's > a untidy hack and it will keep being nothing more than a hack. And sometimes > hacks later come back and bite your bum. > > Bye, > bearophile
