DIP10005: Dependency-Carrying Declarations is now available for community feedback

pineapple via Digitalmars-d digitalmars-d at puremagic.com
Wed Dec 14 02:55:14 PST 2016


On Wednesday, 14 December 2016 at 01:53:44 UTC, Chris M. wrote:
> How about using "imports" instead of "import"? Simple enough 
> change, and it still makes sense
>
> bool equal(R1, R2)
> imports (std.range)
> if (isInputRange!R1 && isInputRange!R2)
> { ... }

On Tuesday, 13 December 2016 at 23:03:39 UTC, Timon Gehr wrote:
> I'd prefer syntax like (import foo.bar).baz and (import 
> foo).bar.baz. (I.e., the syntax of import expressions would 
> closely mirror that of import declarations, and would be 
> unambiguous.)
>
> 2. The behaviour of aliases to import expressions should be 
> defined explicitly.
>
> I.e.
>
> alias short = import very.long.module_name;
>
> void foo(int i)(short.T a){ ... }
>
> does this import the module if foo is not instantiated?

I am most in favor of making the function signature either 
`imports` or `@imports`, or doing this:

struct Buffer(R) if (import std.range:isInputRange!R) { ... }

I also think actually being able to write `alias short = import 
very.long.module_name;` would be great, if only so that the 
contents of a module can be imported into their own user-defined 
namespace rather than the global scope.




More information about the Digitalmars-d mailing list