digitalmars.D.learn - std.typecons.Flag -- public import for API users?
- rcorre (9/9) Mar 21 2015 If I am developing a library and some of my functinos take a
- ketmar (3/14) Mar 21 2015 i believe that there is nothing wrong in such public import in this=20
- Rene Zwanenburg (8/17) Mar 24 2015 Should not be necessary. privately import Flag and make a public
- rcorre (2/9) Mar 26 2015 Nice idea Rene, thanks!
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?
Mar 21 2015
On Sat, 21 Mar 2015 23:16:37 +0000, 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'? =20 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. =20 In general, is it considered bad form to 'public import' modules from phobos?i believe that there is nothing wrong in such public import in this=20 particular case.=
Mar 21 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.
Mar 24 2015
On Tuesday, 24 March 2015 at 16:41:28 UTC, Rene Zwanenburg wrote: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.Nice idea Rene, thanks!
Mar 26 2015