<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Nov 5, 2013 at 7:43 PM, Chris Cain <span dir="ltr"><<a href="mailto:clcain@uncg.edu" target="_blank">clcain@uncg.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im">On Wednesday, 6 November 2013 at 02:38:57 UTC, Timothee Cour wrote:<br>

</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im">
I agree. For that suggest the following syntax (independent of this<br>
proposal):<br>
<br>
That is, support UDA for expressions.<br>
<br>
----<br>
void main(){<br>
  import std.conv:text;<br>
<br>
  int var=12;<br>
<br>
  @("syntax=python")<br>
  r{<br></div>
    ...snip...<br>
  }<br>
}<br>
----<br>
</blockquote>
<br>
I'd very nearly say that this could be a library function. Imagine it like this:<br>
<br>
---<br>
syntax!"python"(r{<br>
...<br>
})<br>
---<br>
<br>
A bit more verbose than using a UDA but the return type could be something like SyntaxType!"python" and you could make it so that functions only take SyntaxType!"python" for some compile-time checking using the type system. For instance, if your function requires python code then you can specify it in the argument. I'd also like it to be implicitly convertable to a generic SyntaxType that accepts everything if you just don't care what kind of syntax it is.<br>

<br>
As long as it's part of the standard library, then IDEs could also take advantage of it. Not saying that they shouldn't also support UDAs, but just throwing that out there as another alternative.<br>
</blockquote></div><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">one problem with this:</div><div class="gmail_extra"><br></div><div class="gmail_extra">r{...} is converted to a built-in tuple, and we can't return built-in tuples from functions (only std.typecons.tuple, which has issues, eg unnecessary copying, can't return elements by ref, etc). Note that returning elements by ref (when needed) is crucial for use case B in the OT (<span style="font-family:arial,sans-serif;font-size:12.727272033691406px">formattedRead).</span></div>
<div class="gmail_extra"><br></div><div class="gmail_extra">On the otherhand, I also thought about using a modification of std.typetuple.Alias that gets an extra 1st argument to indicate syntax.</div><div class="gmail_extra">
It doesn't work because when there's an expression involved we get: Error: variable a cannot be read at compile time; eg: Alias!(a+b,"foo")</div><div class="gmail_extra">and r{...} syntax is suppose to support arbitrary expressions and forward them as builtin tuple.</div>
<div class="gmail_extra"><br></div></div>