digitalmars.D.learn - utils.toBulkString is not accesible from utils
- Andre (19/21) Dec 01 2015 Hi,
- Marc =?UTF-8?B?U2Now7x0eg==?= (3/22) Dec 02 2015 I think so, yes. But according to digger, the current behaviour
- Andre (3/6) Dec 02 2015 Bug report filed
- Jonathan M Davis via Digitalmars-d-learn (8/29) Dec 03 2015 I believe that the problem is that there is no package for toBulkString ...
Hi, for following coding there is an error during compilation: module utils; package string toBulkString(string s) { import std.string: format; return "$%s\r\n%s\r\n".format(s.length, s); } unittest { string actual = "foobar".toBulkString(); //... }The error disappears if I change the visibility attribute from package to private. This seems to be a bug, is it? Version: DMD v2.069.0-b2 Kind regards Andrésource\utils.d(11,39): Error: function utils.toBulkString is not accessible from module utils
Dec 01 2015
On Wednesday, 2 December 2015 at 06:33:36 UTC, Andre wrote:Hi, for following coding there is an error during compilation: module utils; package string toBulkString(string s) { import std.string: format; return "$%s\r\n%s\r\n".format(s.length, s); } unittest { string actual = "foobar".toBulkString(); //... }I think so, yes. But according to digger, the current behaviour goes back to at least DMD 2.052. Please file a bug report anyway.The error disappears if I change the visibility attribute from package to private. This seems to be a bug, is it? Version: DMD v2.069.0-b2source\utils.d(11,39): Error: function utils.toBulkString is not accessible from module utils
Dec 02 2015
On Wednesday, 2 December 2015 at 12:37:29 UTC, Marc Schütz wrote:I think so, yes. But according to digger, the current behaviour goes back to at least DMD 2.052. Please file a bug report anyway.Bug report filed https://issues.dlang.org/show_bug.cgi?id=15395
Dec 02 2015
On Wednesday, December 02, 2015 06:33:32 Andre via Digitalmars-d-learn wrote:Hi, for following coding there is an error during compilation: module utils; package string toBulkString(string s) { import std.string: format; return "$%s\r\n%s\r\n".format(s.length, s); } unittest { string actual = "foobar".toBulkString(); //... }I believe that the problem is that there is no package for toBulkString to be in. utils is a top-level module and is not in a package. Now, arguably it should be an error to use the package attribute in such a module rather than giving an error when you try and use it, but I'm pretty sure that that's the source of your problem. If utils were actually in a package, then it should work. - Jonathan M DavisThe error disappears if I change the visibility attribute from package to private. This seems to be a bug, is it? Version: DMD v2.069.0-b2 Kind regards Andrésource\utils.d(11,39): Error: function utils.toBulkString is not accessible from module utils
Dec 03 2015