Jump to page: 1 2
Thread overview
DIP 1007 - keywords as identifiers with an escape symbol - feedback
Dec 19, 2016
Basile B.
Dec 19, 2016
Stefan Koch
Dec 19, 2016
default0
Dec 19, 2016
Basile B.
Dec 21, 2016
Basile B.
Dec 22, 2016
Chris Wright
Dec 22, 2016
Basile B.
Dec 22, 2016
Basile B.
Dec 22, 2016
Basile B.
Dec 22, 2016
Piotrek
Dec 23, 2016
Chris Wright
Dec 22, 2016
Basile B.
Dec 19, 2016
Basile B.
Dec 19, 2016
Basile B.
December 19, 2016
I know that there is other hot stuffs since a few days but this is a really simple DIP, that has no effect on the grammar and no effect on the semantic. It was drafted after the announce of DIP 1003 last week. During a discussion I've proposed to take a radically different approach. This approach is DIP 1007.

The DIP: https://github.com/dlang/DIPs/pull/52
The implementation: https://github.com/dlang/dmd/pull/6324

p.s: about DIP methodology it's not clearly explained when & how a manager is introduced, apologies if this topic should be opened by someone else !
December 19, 2016
On Monday, 19 December 2016 at 08:14:44 UTC, Basile B. wrote:
> I know that there is other hot stuffs since a few days but this is a really simple DIP, that has no effect on the grammar and no effect on the semantic. It was drafted after the announce of DIP 1003 last week. During a discussion I've proposed to take a radically different approach. This approach is DIP 1007.
>
> The DIP: https://github.com/dlang/DIPs/pull/52
> The implementation: https://github.com/dlang/dmd/pull/6324
>
> p.s: about DIP methodology it's not clearly explained when & how a manager is introduced, apologies if this topic should be opened by someone else !

If you are prepending # you might as well prepend _
December 19, 2016
On Monday, 19 December 2016 at 08:30:07 UTC, Stefan Koch wrote:
> On Monday, 19 December 2016 at 08:14:44 UTC, Basile B. wrote:
>> I know that there is other hot stuffs since a few days but this is a really simple DIP, that has no effect on the grammar and no effect on the semantic. It was drafted after the announce of DIP 1003 last week. During a discussion I've proposed to take a radically different approach. This approach is DIP 1007.
>>
>> The DIP: https://github.com/dlang/DIPs/pull/52
>> The implementation: https://github.com/dlang/dmd/pull/6324
>>
>> p.s: about DIP methodology it's not clearly explained when & how a manager is introduced, apologies if this topic should be opened by someone else !
>
> If you are prepending # you might as well prepend _

That doesn't solve the complications this introduces if you want to serialize to/from members with these names, as seen in the Examples section of the DIP.
December 19, 2016
On Monday, 19 December 2016 at 08:30:07 UTC, Stefan Koch wrote:
> On Monday, 19 December 2016 at 08:14:44 UTC, Basile B. wrote:
>> I know that there is other hot stuffs since a few days but this is a really simple DIP, that has no effect on the grammar and no effect on the semantic. It was drafted after the announce of DIP 1003 last week. During a discussion I've proposed to take a radically different approach. This approach is DIP 1007.
>>
>> The DIP: https://github.com/dlang/DIPs/pull/52
>> The implementation: https://github.com/dlang/dmd/pull/6324
>>
>> p.s: about DIP methodology it's not clearly explained when & how a manager is introduced, apologies if this topic should be opened by someone else !
>
> If you are prepending # you might as well prepend _

No, because # is not an identifier char while _ is.

* _delegate is 1 token (_delegate)
* #delegate is 2 tokens ( # then delegate)

Then you can determine that the intention is to have "delegate" as identifier, while with _ you cant.
December 19, 2016
On Monday, 19 December 2016 at 09:58:28 UTC, default0 wrote:
> On Monday, 19 December 2016 at 08:30:07 UTC, Stefan Koch wrote:
>> On Monday, 19 December 2016 at 08:14:44 UTC, Basile B. wrote:
>>> I know that there is other hot stuffs since a few days but this is a really simple DIP, that has no effect on the grammar and no effect on the semantic. It was drafted after the announce of DIP 1003 last week. During a discussion I've proposed to take a radically different approach. This approach is DIP 1007.
>>>
>>> The DIP: https://github.com/dlang/DIPs/pull/52
>>> The implementation: https://github.com/dlang/dmd/pull/6324
>>>
>>> p.s: about DIP methodology it's not clearly explained when & how a manager is introduced, apologies if this topic should be opened by someone else !
>>
>> If you are prepending # you might as well prepend _
>
> That doesn't solve the complications this introduces if you want to serialize to/from members with these names, as seen in the Examples section of the DIP.

Yes it does. See my answer to Stefan.
In the code you write #delegate, but the identifier is, as known by the compiler, just "delegate". See the unit tests that passed already several times:
https://github.com/dlang/dmd/pull/6324/files#diff-60ac3d231ebb78f79477cc2520a37200R19
December 19, 2016
On Monday, 19 December 2016 at 10:24:08 UTC, Basile B. wrote:
> On Monday, 19 December 2016 at 08:30:07 UTC, Stefan Koch wrote:
>> If you are prepending # you might as well prepend _
>
> No, because # is not an identifier char while _ is.
>
> * _delegate is 1 token (_delegate)
> * #delegate is 2 tokens ( # then delegate)
>
> Then you can determine that the intention is to have "delegate" as identifier, while with _ you cant.

issue for the form of the DIP:

"must explain what is an identifier character and what is not".

I'm a bit surprised that the two first comments are related to this but anyway, I'll add that # is a symbol and _ an identifier char. I must be be biased by the work on CE highlighter.
December 21, 2016
On Monday, 19 December 2016 at 10:28:31 UTC, Basile B. wrote:
> On Monday, 19 December 2016 at 09:58:28 UTC, default0 wrote:
>> That doesn't solve the complications this introduces if you want to serialize to/from members with these names, as seen in the Examples section of the DIP.
>
> Yes it does. See my answer to Stefan.
> In the code you write #delegate, but the identifier is, as known by the compiler, just "delegate". See the unit tests that passed already several times:
> https://github.com/dlang/dmd/pull/6324/files#diff-60ac3d231ebb78f79477cc2520a37200R19

Actually the second example didn't work. I've updated the DIP and added (and this time tested...) an archaic serialization system that shows more clearly what's the point.

It should be quite straightforward to test. The lexer is rarely modified so I doubt there's ever be any conflict when rebasing to master.
December 22, 2016
On Mon, 19 Dec 2016 09:58:28 +0000, default0 wrote:
> On Monday, 19 December 2016 at 08:30:07 UTC, Stefan Koch wrote:
>> If you are prepending # you might as well prepend _
> 
> That doesn't solve the complications this introduces if you want to serialize to/from members with these names, as seen in the Examples section of the DIP.

Sure, but then we could argue that there should be a way to make any sequence of characters an identifier. There are systems that expect serialized field names with hyphens, for instance. Or if I'm writing code to interoperate with a Cherokee system, I might need to produce JSON with a field "ᏗᏍᏚᏗ". (Which is perfectly valid in C# but not in D.)

Jsonizer does this the only way you can: you can use an attribute to specify the serialized name for a field.

While we're talking about this, this proposal breaks any string mixin that mixes in an identifier detected with reflection. Address that problem and your proposal just allows identifiers to contain a leading #. There are usually ways around using string mixins, but we haven't even proposed starting a deprecation process for them.
December 22, 2016
On Thursday, 22 December 2016 at 04:11:54 UTC, Chris Wright wrote:
> While we're talking about this, this proposal breaks any string mixin that mixes in an identifier detected with reflection.

RIP DIP 1007. It was too simple to be true.


December 22, 2016
On Thursday, 22 December 2016 at 10:11:19 UTC, Basile B. wrote:
> On Thursday, 22 December 2016 at 04:11:54 UTC, Chris Wright wrote:
>> While we're talking about this, this proposal breaks any string mixin that mixes in an identifier detected with reflection.
>
> RIP DIP 1007. It was too simple to be true.

I see something to do to continue the DIP

SpecialTokenSequence:
    SpecialTokenSequencePrefix line IntegerLiteral EndOfLine
    SpecialTokenSequencePrefix line IntegerLiteral Filespec EndOfLine
    SpecialTokenSequencePrefixes Keyword

SpecialTokenSequencePrefix:
    #

SpecialTokenSequencePrefixes:
    SpecialTokenSequencePrefix SpecialTokenSequencePrefixes


Which means that you can use As many # as you want to escape a keyword.
Mixins cannot introspect themselves so basically 'pound pound' will always work.
And this is still a simple thing that can be done in the lexer.
« First   ‹ Prev
1 2