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

Manu turkeyman at gmail.com
Tue Nov 5 17:42:32 PST 2013


While thinking on a new string literal that may support DSL's, the syntax
should optionally receive a language specification on opening.
The thing that sucks most about DSL's is that the IDE can't syntax hilight
them, but if it was provided what language the string was, then a smart IDE
could apply syntax hilighting for that language within the scring scope.
Eg, this sort of thing is supported in html, which is usually hilighted
correctly by IDE's:
  <script type="text/javascript"> or <script language="javascript">

And exists in many other places too.


On 6 November 2013 08:26, Timothee Cour <thelastmammoth at gmail.com> wrote:

> actually an important use case of this feature is to help writing domain
> specific language inputs, eg writing a python file inside D, or config /
> plain text files.
> # is common in many languages (eg python/bash etc) as a comment.
>
> @ would be inside string literal so should cause little confusion from D's
> side, but for example would force one to escape '@' in email addresses
> (more rare).
>
> Frankly, this is bike shedding though; let's assume we pick one in
> http://www.ascii-code.com/ and focus on whether we can agree on this
> feature.
>
> I'm using it extensively for great benefit: more DRY code, less spurious
> files, cleaner integration with D.
>
>
>
> On Fri, Nov 1, 2013 at 12:33 AM, Jacob Carlborg <doob at me.com> wrote:
>
>> On 2013-10-31 22:47, Timothee Cour wrote:
>>
>>> $ is another obvious choice (eg in shell expansion)
>>> but # could also be good as it's very much unused in D.
>>>
>>
>> Yeah, # is only used for #line, which should be less common than $.
>>
>> --
>> /Jacob Carlborg
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20131106/afaefea4/attachment.html>


More information about the Digitalmars-d mailing list