如何解决Raku克隆对象未下沉
class A {
has $.n;
# If this method is uncommented then the clone won't be sunk
# method clone {
# my $clone = callwith(|%_);
# return $clone;
# }
method sink(-->Nil) { say "sinking...$!n" }
}
sub ccc(A:D $a) { $a.clone(n=>2) }
ccc(A.new(n=>1));
say 'Done';
上图:
sinking...2
Done
但是,如果使用自定义clone
方法,则出于某些原因,不会{{1}}返回的克隆。如果我在呼叫站点上ccc
显式地将其替换,或者将sink
的行更改为my $clone = callwith(|%_)
,则它可以工作。这是预期的吗?这样工作的原因是什么?
谢谢!
解决方法
以后有很多归档且仍未解决的接收器bug(而且我怀疑还没有归档负载)。
如my answer to Last element of a block thrown in sink context所述:
有人需要清洁厨房的水槽,即在Zoffix因Flaws in implied sinkage / &unwanted helper问题停下来的地方捡拾东西。
Zoffix的结论是:
因此,鉴于系统存在太多问题,我只是想知道是否有更好的系统可以用来指示是否需要某些东西。
快进2年,希望有一个更好的系统。 jnthn在a recent grant report中写道:
,在Rakudo中执行此工作的当前代码很难遵循且效率极低。 ...由于RakuAST在较高水平上对语言进行了建模,并推迟了QAST的产生,直到很久以后,才有可能对接收器分析问题提供更为清晰的解决方案。 ...我很乐观,我创建的模型将足够灵活以处理所有与下沉有关的需求
我不确定发生了什么,但是删除System.Diagnostics.Process proc = new System.Diagnostics.Process();
System.Security.SecureString ssPwd = new System.Security.SecureString();
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.FileName = "filename"; //use the fullpath
proc.StartInfo.Arguments = "args...";
proc.StartInfo.Domain = "domainname";
proc.StartInfo.UserName = "username";
string password = "user entered password";
for (int x = 0; x < password.Length; x++)
{
ssPwd.AppendChar(password[x]);
}
password = "";
proc.StartInfo.Password = ssPwd;
proc.Start();
语句会使克隆的对象调用正确的return
方法。
我为此创建了一个问题:https://github.com/rakudo/rakudo/issues/3855
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。