无法将别名与 receiveOnly 一起使用
Unable to use alias with receiveOnly
public alias Message = int;
void threadFunc(){
import std.concurrency;
while(true){
auto m = receiveOnly!(Message);
}
}
void main(){
import core.thread;
import std.concurrency;
auto t = spawn(&threadFunc);
}
Error: ScopeDsymbol breeze.concurrency.task.__anonymous.__anonymous struct std.concurrency.Message is private
我无法在 receiveOnly
中使用别名。似乎 D 使它们成为我的默认设置,但我明确地将 Message
标记为 public,但错误仍然存在。
问题出在别名 Message
上,它与 std.concurrency
中的私有结构冲突。这已在 2.071.0 版本中修复。因此,您可以将别名升级或更改为其他名称。
更多信息:https://dlang.org/changelog/2.071.0.html#dip22 and here: http://www.schveiguy.com/blog/2016/03/import-changes-in-d-2-071/
public alias Message = int;
void threadFunc(){
import std.concurrency;
while(true){
auto m = receiveOnly!(Message);
}
}
void main(){
import core.thread;
import std.concurrency;
auto t = spawn(&threadFunc);
}
Error: ScopeDsymbol breeze.concurrency.task.__anonymous.__anonymous struct std.concurrency.Message is private
我无法在 receiveOnly
中使用别名。似乎 D 使它们成为我的默认设置,但我明确地将 Message
标记为 public,但错误仍然存在。
问题出在别名 Message
上,它与 std.concurrency
中的私有结构冲突。这已在 2.071.0 版本中修复。因此,您可以将别名升级或更改为其他名称。
更多信息:https://dlang.org/changelog/2.071.0.html#dip22 and here: http://www.schveiguy.com/blog/2016/03/import-changes-in-d-2-071/