节奏的参考类型

发布于 2025-02-02 04:49:15 字数 907 浏览 4 评论 0原文

我一直在使用Flow Playground ft教程,我提出了疑问。 引用应该具有自己的类型,是引用资源类型的引用;例如,对于@collectible资源,其类型为&lt; a.0 ... 01.Collectible&gt;()参考该资源&amp; collectible < /code>我期望像&lt;&amp; a.0..01.collectible&gt;(),但是当在引用上调用getType()函数时,我得到的类型与我在在引用资源上调用该功能。

要澄清,此代码...(可以在上面链接的事务“传输令牌”的第32行中找到)

log(self.temporaryvault.gettype())

log log (receiverRef.getType())

log(self.temporaryVault.getType()== receveriverRef.getType())

...我得到此输出

  • 类型&lt; a.0000000000000000000202.exampleteken。 Vault&gt;()
  • type&lt; a.0000000000000002.c.exampletoken.vault&gt;()
  • true

我在这里缺少什么?

I have been messing around with types, specifically reference types, using the flow playground ft tutorial and I came up with a doubt.
References are supposed to have their own type, a reference to the referenced resource type; e.g for a @Collectible resource whose type will be <A.0...01.Collectible>() a reference to that resource &Collectible I was expecting something like <&A.0..01.Collectible>() but when calling the getType() function on a reference I get the same type that I get when calling said function on the referenced resource.

To clarify, this code... (that can be found on the line 32 of the transaction "Transfer tokens" on the link above)

log(self.temporaryVault.getType())

log(receiverRef.getType())

log(self.temporaryVault.getType() == receiverRef.getType())

...I get this output

  • Type<A.0000000000000002.ExampleToken.Vault>()
  • Type<A.0000000000000002.ExampleToken.Vault>()
  • true

What I'm missing here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

窝囊感情。 2025-02-09 04:49:16

引用始终会自动解除参考 - 操作是在引用值(而不是参考)上执行的。

访问是:例如:

  • 成员访问,访问字段和功能,例如ref.fieldref.func()
  • 索引访问,例如ref [0]

Accesses on references always automatically dereference the reference – operations are performed on the referenced value, not the reference.

Accesses are e.g.:

  • Member accesses, accessing fields and functions, like ref.field or ref.func()
  • Indexing accesses, like ref[0]
海拔太高太耀眼 2025-02-09 04:49:16

这一点很难解释,但是在我的理解中:参考只是对象的代理。

因此,当您实际调用getType()时,实际上是在引用对象上调用它。

This one is little hard to explain, but in my understanding: references are just proxies to the object.

So when you actually call getType(), you are actually calling it on the referenced object.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文