www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - [spec] What's in a name?

reply Dibyendu Majumdar <d.majumdar gmail.com> writes:
Going back (at least) to Dennis Ritchie's C manual from 1975, it 
seems a convention to define what kind of things can be named in 
a language. Is there such a list for D?
May 20
next sibling parent reply Marco de Wild <mdwild sogyo.nl> writes:
On Monday, 20 May 2019 at 22:50:04 UTC, Dibyendu Majumdar wrote:
 Going back (at least) to Dennis Ritchie's C manual from 1975, 
 it seems a convention to define what kind of things can be 
 named in a language. Is there such a list for D?
Do you mean the style guide? https://dlang.org/dstyle.html Or https://dlang.org/spec/lex.html ?
May 20
parent reply Dibyendu Majumdar <d.majumdar gmail.com> writes:
On Tuesday, 21 May 2019 at 04:08:13 UTC, Marco de Wild wrote:
 On Monday, 20 May 2019 at 22:50:04 UTC, Dibyendu Majumdar wrote:
 Going back (at least) to Dennis Ritchie's C manual from 1975, 
 it seems a convention to define what kind of things can be 
 named in a language. Is there such a list for D?
Do you mean the style guide? https://dlang.org/dstyle.html Or https://dlang.org/spec/lex.html ?
Neither.
May 21
parent reply Les De Ridder <les lesderid.net> writes:
On Tuesday, 21 May 2019 at 13:15:21 UTC, Dibyendu Majumdar wrote:
 On Tuesday, 21 May 2019 at 04:08:13 UTC, Marco de Wild wrote:
 On Monday, 20 May 2019 at 22:50:04 UTC, Dibyendu Majumdar 
 wrote:
 Going back (at least) to Dennis Ritchie's C manual from 1975, 
 it seems a convention to define what kind of things can be 
 named in a language. Is there such a list for D?
Do you mean the style guide? https://dlang.org/dstyle.html Or https://dlang.org/spec/lex.html ?
Neither.
I'm not entirely sure what you're asking. If you're trying to replicate the section from Dennis Ritchie's C manual, you might want to look at 'VarDeclarations' in the grammar[1], but I'm not sure such a section would be particularly useful. [1] https://dlang.org/spec/grammar.html#VarDeclarations
May 21
parent reply Dibyendu Majumdar <d.majumdar gmail.com> writes:
On Tuesday, 21 May 2019 at 15:35:18 UTC, Les De Ridder wrote:
 I'm not entirely sure what you're asking.
I guess I don't know how better to put it: I wanted to know what are the things that can be named in a D program.
 If you're trying to replicate the section from Dennis Ritchie's 
 C
 manual, you might want to look at 'VarDeclarations' in the 
 grammar[1],
 but I'm not sure such a section would be particularly useful.

 [1] https://dlang.org/spec/grammar.html#VarDeclarations
Firstly it is not about replicating something from the C manual. A fundamental aspect of any programming language is what things you can give a name to, and then the scope, and lifetime of named objects. A module has a name, so looking at var declarations alone in not sufficient. But I get it: there is no such list.
May 21
parent Basile B. <b2.temp gmx.com> writes:
On Tuesday, 21 May 2019 at 17:15:42 UTC, Dibyendu Majumdar wrote:
 On Tuesday, 21 May 2019 at 15:35:18 UTC, Les De Ridder wrote:
 A module has a name, so looking at var declarations alone in 
 not sufficient.
I told you. All rules containing the Identifier sub rule. I just add 'and that is not an Expression or a Statement' (i.e only DeclDefs)
May 21
prev sibling parent Basile B. <b2.temp gmx.com> writes:
On Monday, 20 May 2019 at 22:50:04 UTC, Dibyendu Majumdar wrote:
 Going back (at least) to Dennis Ritchie's C manual from 1975, 
 it seems a convention to define what kind of things can be 
 named in a language. Is there such a list for D?
Everything that contains the "Identifier" rule falls into the "can be named" category.
May 21