破坏该元组的语法?
因此,我想知道是否有任何支持Dafny中破坏语法的支持。沿着以下几行:
function method f(x:int) : (int,int) { (x,x+1) }
method test() {
var y:int;
var z:int;
(y,z) := f(1);
}
实际上,我想走得更远,因为我想在函数
中破坏。
So, I'm wondering whether there is any support for destructuring syntax in Dafny. Something along the following lines:
function method f(x:int) : (int,int) { (x,x+1) }
method test() {
var y:int;
var z:int;
(y,z) := f(1);
}
In fact, I want to go further than this as I want to destructure within a function
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据参考手册但是仅对于可变声明语句,例如:
如果要注释这些类型,则可以这样做:
您也可以使用Let Expression在函数中执行此操作,例如:
According to the reference manual, you cannot do it for assignment statements, but only for variable declaration statements, like this:
If you want to annotate the types, you can do it like this:
You can also use a let expression to do this inside a function, like this: