August 27, 2016
On Saturday, 27 August 2016 at 19:21:52 UTC, Walter Bright wrote:
> It also:
>
> 1. mucks with the usability of syntax highlighting, which is often based merely on tokens.
> 2. makes it potentially much more difficult to add features to the language, which is often done by finding new uses for the same keywords
> 3. is just plain confusing to the person learning the language
> 4. makes correctly diagnosing syntactic errors harder
>
> There are a million words in the english language. Having a handful of reserved words should not be a burden.

Could we at least make body a contextual keyword? It's a commonly used word in many different areas.
August 28, 2016
On Saturday, 27 August 2016 at 20:45:56 UTC, Meta wrote:
> On Saturday, 27 August 2016 at 19:21:52 UTC, Walter Bright wrote:
>> It also:
>>
>> 1. mucks with the usability of syntax highlighting, which is often based merely on tokens.
>> 2. makes it potentially much more difficult to add features to the language, which is often done by finding new uses for the same keywords
>> 3. is just plain confusing to the person learning the language
>> 4. makes correctly diagnosing syntactic errors harder
>>
>> There are a million words in the english language. Having a handful of reserved words should not be a burden.
>
> Could we at least make body a contextual keyword? It's a commonly used word in many different areas.

YEAH! PLEASE-PLEASE-PLEASE-PLEASE! i did that, and it never broke anything for years. as for syntax highlighters -- it's not too hard to check if `body` is followed by `{`. but getting our precious `body` back will be invaluable!
August 28, 2016
On Sunday, 28 August 2016 at 02:35:57 UTC, ketmar wrote:
> On Saturday, 27 August 2016 at 20:45:56 UTC, Meta wrote:
>> On Saturday, 27 August 2016 at 19:21:52 UTC, Walter Bright wrote:
>>> It also:
>>>
>>> 1. mucks with the usability of syntax highlighting, which is often based merely on tokens.
>>> 2. makes it potentially much more difficult to add features to the language, which is often done by finding new uses for the same keywords
>>> 3. is just plain confusing to the person learning the language
>>> 4. makes correctly diagnosing syntactic errors harder
>>>
>>> There are a million words in the english language. Having a handful of reserved words should not be a burden.
>>
>> Could we at least make body a contextual keyword? It's a commonly used word in many different areas.
>
> YEAH! PLEASE-PLEASE-PLEASE-PLEASE! i did that, and it never broke anything for years. as for syntax highlighters -- it's not too hard to check if `body` is followed by `{`.

You must keep track of the previous token, which is not usually done in a scanner.
Once again, the D style says to add a "_" after the keyword. If it's a problem with the reflection it's also easy to check if an identifier ends with "_" and then to remove it.

The examples of contextual keywords given by W.Bright in a previous message are totally different from the "body" case because in `extern(C)`, "C" is an identifier that becomes a keyword in the context, while what you propose is that a keyword becomes an identifier out of the context.
August 27, 2016
On 8/27/2016 7:35 PM, ketmar wrote:
> getting our precious `body` back will be invaluable!

You are not of the body!

https://www.youtube.com/watch?v=m48xii7ndcg
August 28, 2016
On Sun, 28 Aug 2016 04:32:46 +0000, Basile B. wrote:
> Once again, the D style says to add a "_" after the keyword. If it's a problem with the reflection it's also easy to check if an identifier ends with "_" and then to remove it.

Or use UDAs, which would be more general.
August 28, 2016
On Sunday, 28 August 2016 at 04:32:46 UTC, Basile B. wrote:
sorry, i cannot find where exactly i was asked about workaround for "stolen body" case. maybe it's 'cause i DIDN'T ASKED FOR WORKAROUND?
August 28, 2016
On Sunday, 28 August 2016 at 04:32:46 UTC, Basile B. wrote:
> You must keep track of the previous token, which is not usually done in a scanner.

That sounds like a pretty trivial feature to me. There's no way that's a legitimate obstacle.
August 28, 2016
On Sunday, 28 August 2016 at 08:07:27 UTC, Cauterite wrote:
> On Sunday, 28 August 2016 at 04:32:46 UTC, Basile B. wrote:
>> You must keep track of the previous token, which is not usually done in a scanner.
>
> That sounds like a pretty trivial feature to me. There's no way that's a legitimate obstacle.

Look at this, this is perfectly valid D code:

void main()
in {}
body /**/ #line 8
/**/
//
/+
/+
+/
+/
{}

to think that it can be detected with a simple lookup backward (or forward from the KW) is too simplistic.
August 28, 2016
On Sunday, 28 August 2016 at 08:25:38 UTC, Basile B. wrote:
> On Sunday, 28 August 2016 at 08:07:27 UTC, Cauterite wrote:
>> On Sunday, 28 August 2016 at 04:32:46 UTC, Basile B. wrote:
>>> You must keep track of the previous token, which is not usually done in a scanner.
>>
>> That sounds like a pretty trivial feature to me. There's no way that's a legitimate obstacle.
>
> Look at this, this is perfectly valid D code:
>
> void main()
> in {}
> body /**/ #line 8
> /**/
> //
> /+
> /+
> +/
> +/
> {}
>
> to think that it can be detected with a simple lookup backward (or forward from the KW) is too simplistic.

i have a perfect solution to this: don't write such code!
August 28, 2016
On Sunday, 28 August 2016 at 08:25:38 UTC, Basile B. wrote:
> to think that it can be detected with a simple lookup backward (or forward from the KW) is too simplistic.

I'm not saying it'd necessarily be easy to distinguish keyword 'body' from identifier 'body' in the lexer, I'm just saying a 'look-behind' feature in a lexer would be trivial to implement.