www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 357] New: D keywords in import/module are (unnecessary) forbidden

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=357

           Summary: D keywords in import/module are (unnecessary) forbidden
           Product: D
           Version: 0.167
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: aarti interia.pl


It is a quite a big shortcoming: you can not have e.g. 'interface' directory in
your project file structure.

D keyword should be allowed in import/module declarations as it (probably)
don't make unnecessary ambiguities.


-- 
Sep 20 2006
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=357


fvbommel wxs.nl changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         OS/Version|Linux                       |All




------- Comment #1 from fvbommel wxs.nl  2006-09-20 17:19 -------
Allowing this would wreak havoc on fully qualified names. Either those would
effectively be disallowed for those modules or the restrictions that
identifiers can't contain keywords would have to be lifted.
The latter solution would definitely create ambiguities. Think of the following
code, for example:

    import alias;
    // ... some more code ...
    alias.foo bar;

Does this declare a variable bar of type alias.foo, or does this create an
alias bar for an identifier foo in the top-level namespace?

This is a bad idea. Either inconsistencies or ambiguities will be introduced if
this change is made.


-- 
Sep 20 2006
prev sibling next sibling parent Derek Parnell <derek psyc.ward> writes:
On Wed, 20 Sep 2006 21:58:18 +0000 (UTC), d-bugmail puremagic.com wrote:

 http://d.puremagic.com/issues/show_bug.cgi?id=357
 
            Summary: D keywords in import/module are (unnecessary) forbidden
            Product: D
            Version: 0.167
           Platform: Other
         OS/Version: Linux
             Status: NEW
           Severity: normal
           Priority: P2
          Component: DMD
         AssignedTo: bugzilla digitalmars.com
         ReportedBy: aarti interia.pl
 
 It is a quite a big shortcoming: you can not have e.g. 'interface' directory in
 your project file structure.
 
 D keyword should be allowed in import/module declarations as it (probably)
 don't make unnecessary ambiguities.

I think its there to help prevent things like ... import this; . . . this.xyz; // 'this' is a module reference ??? -- Derek Parnell Melbourne, Australia "Down with mediocrity!"
Sep 20 2006
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=357


bugzilla digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX




------- Comment #2 from bugzilla digitalmars.com  2006-09-21 03:08 -------
Clean separation between keywords and identifiers minimizes parsing ambiguities
and all sorts of confusion.


-- 
Sep 21 2006
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=357


aarti interia.pl changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WONTFIX                     |




------- Comment #3 from aarti interia.pl  2006-09-27 16:07 -------
When after discussion I (almost*) completely agree with arguments I would just
request to add single sentence to documentation about requirement that module
names and file names can not be D keyword. It is very important design decision
and should be documented.

*Almost, because it seems that only first part of module name could make
problems. e.g. dbase.interface seems to be ok.


-- 
Sep 27 2006
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=357





------- Comment #4 from aarti interia.pl  2006-10-07 13:54 -------
... of course probably best solution would be to have 'keyword escape
character' like e.g.  

In such a way you could declare following module:

module  this. is. interface. module;
:-)

Current state gives impression that D imposes really big restrictions on what
is possible to do with the language: you can not use arbitrary directories
and/or filenames when organizing your project.


-- 
Oct 07 2006
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=357


bugzilla digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |WONTFIX




------- Comment #5 from bugzilla digitalmars.com  2008-06-25 18:50 -------
Although the grammar for the packages says they are Identifiers which
implicitly excludes them being keywords, I'll clarify the documentation on that
point. Otherwise, it is working as designed.

I agree you cannot use arbitrary names for module file names - the names must
be valid D identifiers. While a restriction, I don't think it is onerous or
overly restrictive.

You can put modules in arbitrarily named directories, but those directories
cannot then be used as package names. Package names must correspond to D
identifiers.

I don't think there is enough benefit to changing this to justify the cost.


-- 
Jun 25 2008