On Tue, Nov 5, 2013 at 5:42 PM, Manu <turkeyman@gmail.com> wrote:
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.

I agree. For that suggest the following syntax (independent of this proposal):

That is, support UDA for expressions.

----
void main(){
  import std.conv:text;

  int var=12;

  @("syntax=python")
  r{
    def fun:
      print(@var) #will expand to tuple element 12
      print(@(var.to!string)) #will expand to tuple element "12"

    }
   .text
   .run_python;

  void run_python(string a){
    import std.system;
    system("python -c "~a.escapeShellFileName);
  }
}
----