<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Dec 10, 2016 at 4:43 PM, Basile B. via Digitalmars-d-announce <span dir="ltr"><<a href="mailto:digitalmars-d-announce@puremagic.com" target="_blank">digitalmars-d-announce@puremagic.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Saturday, 10 December 2016 at 13:49:09 UTC, Basile B. wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Monday, 28 November 2016 at 02:17:20 UTC, Dicebot wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 11/24/2016 05:29 PM, WM.H wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Saturday, 19 November 2016 at 21:16:15 UTC, Dicebot wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
DIP 1003 is merged to the queue and open for public informal feedback.<br>
<br>
PR: <a href="https://github.com/dlang/DIPs/pull/48" rel="noreferrer" target="_blank">https://github.com/dlang/DIPs/<wbr>pull/48</a><br>
Initial merged document:<br>
<a href="https://github.com/dlang/DIPs/blob/master/DIPs/DIP1003.md" rel="noreferrer" target="_blank">https://github.com/dlang/DIPs/<wbr>blob/master/DIPs/DIP1003.md</a><br>
<br>
If you want the change to be approved and have ideas how to improve it to better match on <a href="https://github.com/dlang/DIPs/blob/master/GUIDELINES.md" rel="noreferrer" target="_blank">https://github.com/dlang/DIPs/<wbr>blob/master/GUIDELINES.md</a> and existing published reviews - please submit new PR with editorial and ping original author.<br>
</blockquote>
<br>
This DIP fixes the problem for "body" but not for the other keywords. After all the problem may exist for other keywords. Was a new pragma considered ? For example an identifier alias.<br>
<br>
pragma(idAlias, "body", "body_" )<br>
</blockquote>
<br>
AFAIU, the point of this DIP is that "body" is standing out from other keywords being used only in one very specific context and being a very common english word at the same time. Your proposal has a completely different (and much more drastic) approach.<br>
</blockquote>
<br>
Yes. But while it's clear that "body" is a keyword that's less related to programming languages than the others (i.e more usable as identifier), it's not actually that mad to imagine a generic approach. For example Object Pascal has such a feature:<br>
<br>
<a href="http://wiki.freepascal.org/FPC_New_Features_2.6.0#Support_for_.26-escaping_of_keywords" rel="noreferrer" target="_blank">http://wiki.freepascal.org/FPC<wbr>_New_Features_2.6.0#Support_<wbr>for_.26-escaping_of_keywords</a><br>
<br>
which is not well known, as I've myself discovered this just 3 minutes ago.<br>
In D there would be the "#" token that's not really used, which could serve to escape keywords, while still considering them as identifier when it's needed, e.g<br>
<br>
struct Body{}<br>
Body #body;<br>
writeln("'", #body.stringof, "'");<br>
<br>
would output: 'body'<br>
</blockquote>
<br></div></div>
By the way a pragma was a bad idea. Pragmas are optionally supported by a compiler. An escape symbol is by far better. Whatever is the compiler we always want the same result.<br>
<br>
Any chance to get "Cauterite" thoughts on the option that is to have a token used to escape a keyword, so that the kw can be used as identifier ?<br>
<br>
The initial DIP is too specialized, however it shows a real problem:<br>
<br>
What if one day someone wants<br>
<br>
    enum FlagsModifiedByAsmCmp {of, if, zf, cf} ?<br>
    function Function;<br>
<br>
With an escape it would always work<br>
<br>
    enum FlagsModifiedByAsmCmp {of, #if, zf, cf}<br>
    #function Function;<br>
<br>
The problem of the suffix "_", as proposed in D style guide, is that it's also a valid identifier character, while "#" is not. And the best is that # role is already for special token sequences !<br>
- # = token for special token sequence<br>
- body = token<br>
=> #body is a special token sequence.<br>
<br>
The only thing to change is that currently a special token sequence takes a full line...but seriously that's a minor change (since there's no special token sequence in D... #line is obsolete and not used anymore).<br>
</blockquote></div><br></div><div class="gmail_extra">Why is #line obsolete? I use it a lot in string mixins to make the correct line numbers show.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Thanks!</div></div>