std.typecons.Flag -- public import for API users?

Rene Zwanenburg via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Mar 24 09:41:27 PDT 2015


On Saturday, 21 March 2015 at 23:16:39 UTC, rcorre wrote:
> If I am developing a library and some of my functinos take a 
> std.typecons.Flag as an argument, should I 'public import 
> std.typecons: Flag, Yes, No'?
>
> It seems like it would be a pain for users of the library to 
> have to import this separately whenever they use my library, 
> but I'm not sure what the stance is on having your modules 
> `public import` standard-library modules.
>
> In general, is it considered bad form to 'public import' 
> modules from phobos?

Should not be necessary. privately import Flag and make a public 
alias:

module a;
import std.typecons : Flag;

alias SomeFlag = Flag!"SomeFlag";

SomeFlag.Yes and SomeFlag.No should be usable in other modules 
without additional imports.


More information about the Digitalmars-d-learn mailing list