Allows the use of part of the language keywords?
Basile B. via Digitalmars-d
digitalmars-d at puremagic.com
Sat Aug 27 21:32:46 PDT 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.
More information about the Digitalmars-d
mailing list