www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12314] New: Allow Duplicate Renamed Imports

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

           Summary: Allow Duplicate Renamed Imports
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: jbinero gmail.com


--- Comment #0 from Jeroen Bollen <jbinero gmail.com> 2014-03-07 12:19:54 PST
---
It should be allowed for renaming the same import twice, with the same name. 

    // This should be possible
    private import gtk = gtk.Application;
    private import gtk = gtk.Window;

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 07 2014
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12314


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc


--- Comment #1 from bearophile_hugs eml.cc 2014-03-07 13:06:25 PST ---
(In reply to comment #0)
 It should be allowed for renaming the same import twice, with the same name. 
 
     // This should be possible
     private import gtk = gtk.Application;
     private import gtk = gtk.Window;

Please list what are the advantages an disadvantages of this proposal. (At first sight I don't like it, but perhaps I am wrong). -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 07 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12314



--- Comment #2 from Jeroen Bollen <jbinero gmail.com> 2014-03-07 13:10:07 PST
---
(In reply to comment #1)
 Please list what are the advantages an disadvantages of this proposal. (At
 first sight I don't like it, but perhaps I am wrong).

The main advantage is that when you have libraries like the GtkD which I used in the first post, you can put them all in one namespace. This way you don't get the redundancy of specifying the exact module name for every call to a function, but you still keep your code clean and maintainable by specifying what library a certain class/struct/object belongs to. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 07 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12314



--- Comment #3 from bearophile_hugs eml.cc 2014-03-07 13:24:32 PST ---
(In reply to comment #2)
 (In reply to comment #1)
 Please list what are the advantages an disadvantages of this proposal. (At
 first sight I don't like it, but perhaps I am wrong).

The main advantage is that when you have libraries like the GtkD which I used in the first post, you can put them all in one namespace. This way you don't get the redundancy of specifying the exact module name for every call to a function, but you still keep your code clean and maintainable by specifying what library a certain class/struct/object belongs to.

What are the disadvantages? -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 07 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12314



--- Comment #4 from Jeroen Bollen <jbinero gmail.com> 2014-03-07 13:26:21 PST
---
(In reply to comment #3)
 (In reply to comment #2)
 The main advantage is that when you have libraries like the GtkD which I used
 in the first post, you can put them all in one namespace. 
 
 This way you don't get the redundancy of specifying the exact module name for
 every call to a function, but you still keep your code clean and maintainable
 by specifying what library a certain class/struct/object belongs to.

What are the disadvantages?

I can't really think of any. Obviously it can cause conflicts if you have two matching symbols and you put them in the same module/namespace; but conflicts are already possible as-is, and should be avoided. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 07 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12314


Vladimir Panteleev <thecybershadow gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thecybershadow gmail.com


--- Comment #5 from Vladimir Panteleev <thecybershadow gmail.com> 2014-03-07
23:28:17 EET ---
How is this different from a package.d file?

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 07 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12314



--- Comment #6 from Jeroen Bollen <jbinero gmail.com> 2014-03-07 13:33:17 PST
---
(In reply to comment #5)
 How is this different from a package.d file?

You mean having a separate module publicly importing all the required modules? The difference would be that not a separate module would be needed for every different set of includes possible. Obviously you could make one file simply importing everything, but that'd just be an over-kill. When a module only uses 2 or 3 modules it's not worth importing every single one of them. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 07 2014