www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15402] New: Make it an error to declare package level symbols

https://issues.dlang.org/show_bug.cgi?id=15402

          Issue ID: 15402
           Summary: Make it an error to declare package level symbols when
                    there is no package
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: issues.dlang jmdavisProg.com

As indicated by issue# 8716 and issue# 15395, at least occasionally, folks use
the package attribute on symbols in modules that aren't actually in a package
(since they're at the top level of the hierarchy). Given that it makes no sense
to use the package attribute on _anything_ in a top-level module, I'd suggest
that it be made into an error to do so. Certainly, it makes more sense than
allowing an unusable function to be declared and then make it an error to use
it, which is the current behavior.

--
Dec 03 2015