msgpack-d: package import; 64 bit
kdevel
kdevel at vogtner.de
Fri Jan 8 20:08:28 UTC 2021
Here a condensed version of the problem I encountered after
updating to
msgpack-d 1.0.3 and not merging a local patch of this [1] line:
```sub.d
module sub;
import l2;
void foo ()
{
import std.stdio: writeln;
bar();
auto fn = &isDir!string;
writeln (`isDir fn ptr = `, fn);
}
unittest {
foo;
}
```
```l2/package.d
module l2;
void bar ()
{
import std.stdio: writeln;
writeln ("this is ", __PRETTY_FUNCTION__);
}
version (unittest) {
package import std.file;
}
unittest {
}
```
$ dmd -i -unittest -main -run sub
this is void l2.bar()
isDir fn ptr = 123456
2 unittests passed
$ dmd -i -c sub
sub.d(7): Error: template instance isDir!string template isDir is
not defined
One interesting part about "package import" is
"By the way, `package import` seems to work just like `public
import`,
not restricting anything. Looks like a compiler bug." [2]
From now on I will use only selective imports.
[1]
https://github.com/msgpack/msgpack-d/blob/master/src/msgpack/packer.d#L894
IFAICS the unittest works perfectly with a plain vanilla import.
BTW:
---------------------------- src/msgpack/packer.d
-----------------------------
index d92a74e..77bcf07 100644
@@ -1129,8 +1129,7 @@ unittest
}
}
- version (X86_64) // can't create a long enough array to
trigger this on x86
- { // larger spec size for string / binary
+ static if ((byte*).sizeof > 4) {
mixin DefinePacker;
try {
[2]
http://forum.dlang.org/thread/lwdasivphymhblwxasgc@forum.dlang.org#post-qaer55:2431h0:241:40digitalmars.com
More information about the Digitalmars-d-learn
mailing list