Summary: [module] Imports should be valid at any scope
           Product: D
           Version: future
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD

--- Comment #0 from Leandro Lucarella <> 2009-11-13 16:37:38 
PST ---
Imports should be valid at any scope, like classes, structs, and functions.
This is specially useful for unit tests for example, currently this idiom is

version (unittest) import foo;

unittest {;

It would be much nicer to be able to just write:

unittest {
  import foo;;

This brings more locality to the code. This limitation is like C's (pre C99)
inability to add variable declarations after the first statement. It easier to
refactor code this way too, if I move the unittest (function, class or
whatever) to another file, my imports are moved too without any further work,
now I have to track all the import and remove/add appropriately.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to