在 Rebol 中如何获取对象路径中的父级?
是否有一个函数可以获取对象的父对象,例如
parent-of system/console/history
会给出
system/console
Is there a function to get the parent of an object for example
parent-of system/console/history
would give
system/console
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看来你还没有意识到那条路! value是一个系列的类型! value:
所以只需删除该系列中的最后一个值即可:
It seems that you don't realise that a path! value is a type of series! value:
So just remove the last value in the series:
如果 history 对象只有一个父对象,Peter 是对的。但它可能还有其他:
my-object: make object! [history: system/console/history]
history 现在有三个合法的父级:
您认为真正的父级实际上取决于您。据我所知,没有简单的方法可以找到对象(或块)所属的所有上下文。
Peter is right if the history object has just one parent. But it may have others:
my-object: make object! [history: system/console/history]
history is now has three legitimate parents:
Which you consider to the the real parent is really up to you. There is no easy way that I know of to find all the contexts an object (or block) is part of.